Sum vs MEX#13063

Sum vs MEX

2 seconds
256 megabytes

You're given an integer . A permutation of elements is called good if the following condition holds:

for each index (1 \le i \le n) : \sum\limits_{j=1}^{i} p_j is divisible by (p_1 , p_2 , \ldots, p_i).

where is the smallest positive integer which isn't present in the array maximize the permutation using some memorization-like process.

Find a good permutation of elements or report that it's impossible.

Input

The first line contains a single integer (1 \le t \le 700)— the number of test cases.

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

It's guaranteed that the sum of over all testcases does not exceed 2 \cdot 10^5.

Output

For each test case, print if there is a good permutation , then print a good permutation of elements , or print if there isn't any good permutation.

Examples

Example 1

Loading
Loading

Note

In the third test case p = [3,1,4,2] works because

  1. When i = 1 , p_1 = 3 , \text{MEX}(3) = 1 and 3 \bmod 1= 0 thus valid.

  2. When i = 2 , p_1 + p_2 = 4 , \text{MEX}(3 , 1) = 2 and 4 \bmod 2=0 thus valid.

  3. When i = 3 , p_1 + p_2 + p_3 = 8 , \text{MEX}(3 , 1 , 4) = 2 and 8 \bmod 2=0 thus valid.

  4. When i = 4 , p_1 + p_2 + p_3 + p_4 = 10 , \text{MEX}(3,1,4,2) = 5 and 10 \bmod 5=0 thus valid.

Therefore the permutation is a valid construction.

Scoring

  • Subtask ( points): \sum n \le 10.

  • Subtask ( points): No additional constraints.