333 Permutation#11838

333 Permutation

1 second
256 megabytes
Hard

"Permutations are Back !"

TheFatRat & NEFFEX - Back One Day [SilentCrafter Remix]

Given an integer , construct any permutation of \{1,2,3,...,n\} such that

\displaystyle (p_i+p_{i+1}+p_{i+2}) \text{ is not divisible by } 3

Holds for all (1 \le i \le n-2).

Input

The first line contains a single integer (1 \le t \le 10^4) – the number of test cases.

The only line of each test case contains a single integer (4 \le n \le 2 \cdot 10^5) – the length of permutation .

It's guaranteed that the sum of overall tests doesn't exceed 2 \cdot 10^5.

Output

For each test case, output permutation of p_1,p_2,..,p_n satisfying the condition.

It's guaranteed that such a permutation always exists.

Examples

Example 1

Loading
Loading

Note

In the first test case , the sums are (2+4+1),(4+1+3) which are respectively , both of them are not divisible by .

In the second test case , the sums are (2+5+1),(5+1+4),(1+4+3) which are respectively , all of them are not divisible by .

Scoring

  1. Subtask ( points) : (4 \le n \le 8)

  2. Subtask ( points) : (n=16)

  3. Subtask ( points) : (n=17)

  4. Subtask ( points) : (n \le 30)

  5. Subtask ( points) : (4 \le n \le 100)

  6. Subtask ( points) : (n \bmod 3=0)

  7. Subtask ( points) : (4 \le n \le 1000)

  8. Subtask ( points) : No additional constraints.