
ZOJ Problem Set  4032
Given an integer $n$, we say a point $(x, y)$ on a 2D plane is a magic point, if and only if both $x$ and $y$ are integers, and exactly one of the following conditions is satisfied:
It's easy to discover that there are $(4n  4)$ magic points in total. These magic points are numbered from $0$ to $4n5$ in counterclockwise order starting from $(0, 0)$. DreamGrid can create $n$ magic lines from these magic points. Each magic line passes through exactly two magic points but cannot be parallel to the line $x = 0$ or $y = 0$ (that is to say, the coordinate axes). The intersections of the magic lines are called dream points, and for some reason, DreamGrid would like to make as many dream points as possible. Can you tell him how to create these magic lines? InputThere are multiple test cases. The first line of input contains an integer $T$ (about 100), indicating the number of test cases. For each test case, there is only one integer $n$ ($2 \le n \le 1000$). OutputFor each case output $2n$ integers $p_1, p_2, \dots, p_{2n}$ in one line separated by one space, indicating that in your answer, point $p_{2k1}$ and point $p_{2k}$ is connected by a line for all $1 \le k \le n$. If there are multiple answers, you can print any of them. Sample Input3 2 3 4 Sample Output0 2 1 3 1 4 2 5 3 6 0 6 1 9 3 8 4 10 HintThe sample test cases are shown as follow: Author: ZHOU, Yuchen Source: The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple 