Welcome to ZOJ Problem Sets Information Select Problem Runs Ranklist ZOJ Problem Set - 4032
Magic Points

Time Limit: 1 Second      Memory Limit: 65536 KB      Special Judge

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:

• $0 \le x < n$ and $y = 0$;

• $0 \le x < n$ and $y = n-1$;

• $x = 0$ and $0 \le y < n$;

• $x = n-1$ and $0 \le y < n$.

It's easy to discover that there are $(4n - 4)$ magic points in total. These magic points are numbered from $0$ to $4n-5$ in counter-clockwise 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?

#### Input

There 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$).

#### Output

For 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_{2k-1}$ 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 Input

3
2
3
4


#### Sample Output

0 2 1 3
1 4 2 5 3 6
0 6 1 9 3 8 4 10


#### Hint

The sample test cases are shown as follow: Author: ZHOU, Yuchen
Source: The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple
Submit    Status