#P7808. Last Problem

Last Problem

Last Problem

Problem Description

It's the night before Zhang3's birthday, and she's preparing for her birthday party in the classroom. She has brought a huge birthday cake and some powerful tomatoes, and has decorated almost every corner of the classroom. However, the blackboard is still empty. The last thing to do is to draw a beautiful pattern on it. The blackboard is regarded as an infinite plane, each integer point (x,y)(x, y) has an integer value as its color. At the very beginning, the color of every point is 00. Zhang3 has nn crayons, labeled 1,2,,n1, 2, \ldots, n. Painting with the ithi ^ \mathrm{th} crayon, you can replace the color of some chosen integer point (x,y)(x, y) with color ii. It is called a step, and she will draw the pattern step by step. According to Zhang3's judgement of beautiful patterns, there's a restriction: Just before you paint (x,y)(x, y) into some color ii, the last four colors of ii must appear among the adjacent points of (x,y)(x, y). The last four colors of ii means colors from (i4)(i - 4) to (i1)(i - 1), ignoring those non-positive ones. Two integer points are adjacent if their Euclid distance is exactly one. (Note that a point is not adjacent to itself.) If the condition above is not satisfied, the step is not allowed. Zhang3 doesn't want to waste crayons, so the final pattern should contain at least one point with color nn. Please help her find a way to draw such a beautiful pattern.

Input

The only line of the input contains an integer n  (1n100)n \; (1 \le n \le 100), the number of crayons.

Output

Print the steps in chronological order, each in a separate line. Notice that you should not print the number of steps. In the ithi ^ \mathrm{th} line, print three integers xi,yi,cix_i, y_i, c_i, separated by spaces, indicating the ithi ^ \mathrm{th} step is to paint (xi,yi)(x_i, y_i) into color cic_i. Your answer should satisfy xi,yi109,  1cin|x_i|, |y_i| \le 10^9, \; 1 \le c_i \le n. The number of steps should not exceed 10510^5. The output file should not be larger than 5  MB5 \; \text{MB}. It can be proved that there is always a solution. Any solution that meets all of the requirements will be accepted.

Sample Input

4

Sample Output

0 0 1
1 0 1
0 1 2
1 1 3
1 -1 2
1 0 4

Hint

1st step: paint (0, 0) into color 1. 000 010 000 2nd step: paint (1, 0) into color 1. 0000 0110 0000 3rd step: paint (0, 1) into color 2. 0000 0200 0110 0000 4th step: paint (1, 1) into color 3. 0000 0230 0110 0000 5th step: paint (1, -1) into color 2. 0000 0230 0110 0020 0000 6th step: paint (1, 0) into color 4. 0000 0230 0140 0020 0000

Source

2020 Multi-University Training Contest 4