CF2037C.Superultra's Favorite Permutation

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Superultra's Favorite Permutation

Superultra, a little red panda, desperately wants primogems. In his dreams, a voice tells him that he must solve the following task to obtain a lifetime supply of primogems. Help Superultra!

Construct a permutation^{\text{∗}} pp of length nn such that pi+pi+1p_i + p_{i+1} is composite^{\text{†}} over all 1in11 \leq i \leq n - 1. If it's not possible, output 1-1.

^{\text{∗}}A permutation of length nn is an array consisting of nn distinct integers from 11 to nn in arbitrary order. For example, [2,3,1,5,4][2,3,1,5,4] is a permutation, but [1,2,2][1,2,2] is not a permutation (22 appears twice in the array), and [1,3,4][1,3,4] is also not a permutation (n=3n=3 but there is 44 in the array).

^{\text{†}}An integer xx is composite if it has at least one other divisor besides 11 and xx. For example, 44 is composite because 22 is a divisor.

Input

The first line contains tt (1t1041 \leq t \leq 10^4) — the number of test cases.

Each test case contains an integer nn (2n21052 \leq n \leq 2 \cdot 10^5) — the length of the permutation.

It is guaranteed that the sum of nn over all test cases does not exceed 21052 \cdot 10^5.

Output

For each test case, if it's not possible to construct pp, output 1-1 on a new line. Otherwise, output nn integers p1,p2,,pnp_1, p_2, \ldots, p_n on a new line.

Note

In the first example, it can be shown that all permutation of size 33 contain two adjacent elements whose sum is prime. For example, in the permutation [2,3,1][2,3,1] the sum 2+3=52+3=5 is prime.

In the second example, we can verify that the sample output is correct because 1+81+8, 8+78+7, 7+37+3, 3+63+6, 6+26+2, 2+42+4, and 4+54+5 are all composite. There may be other constructions that are correct.

Samples

2
3
8
-1
1 8 7 3 6 2 4 5

在线编程 IDE

建议全屏模式获得最佳体验