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) has an integer value as its color. At the very beginning, the color of every point is 0.
Zhang3 has n crayons, labeled 1,2,…,n. Painting with the ith crayon, you can replace the color of some chosen integer point (x,y) with color i. 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) into some color i, the last four colors of i must appear among the adjacent points of (x,y). The last four colors of i means colors from (i−4) to (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 n. Please help her find a way to draw such a beautiful pattern. 这是张3生日的前一天晚上,她正在教室里准备她的生日派对。她带来了一个巨大的生日蛋糕和一些强效的西红柿,并装饰了教室的几乎每个角落。然而,黑板仍然是空的。最后要做的就是在上面画一个漂亮的图案。
The only line of the input contains an integer n(1≤n≤100), the number of crayons.
输入的唯一一行包含整数n(1≤n≤100),即蜡笔的数量。
输出格式
Print the steps in chronological order, each in a separate line. Notice that you should not print the number of steps.
In the ith line, print three integers xi,yi,ci, separated by spaces, indicating the ith step is to paint (xi,yi) into color ci.
Your answer should satisfy |xi|,|yi|≤109,1≤ci≤n. The number of steps should not exceed 105. The output file should not be larger than 5MB.
It can be proved that there is always a solution. Any solution that meets all of the requirements will be accepted. 按时间顺序打印步骤,每一步都在单独的一行中。请注意,您不应该打印步骤数。
在第i行中,打印三个整数xi、yi、ci,用空格隔开,表示第i步是将(xi、yi)绘制成颜色ci。
你的答案应该满足|xi|,|yi|≤109,1≤ci≤n。步骤数不应超过10^5。输出文件不应大于5MB。
可以证明,总是有解决方案的。任何满足所有要求的解决方案都将被接受。
输入样例
复制
4
输出样例
复制
0 0 1
1 0 1
0 1 2
1 1 3
1 -1 2
1 0 4
数据范围与提示
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