| Codeforces Round 1135 (Div. 2) |
|---|
| Finished |
You are given an integer $$$n$$$. Construct a permutation$$$^{\text{∗}}$$$ $$$p$$$ of length $$$n$$$ such that $$$i \cdot p_i$$$ is composite$$$^{\text{†}}$$$ for every $$$1 \le i \le n$$$, or determine that no such permutation exists.
$$$^{\text{∗}}$$$A permutation of length $$$n$$$ is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array), and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$4$$$ in the array).
$$$^{\text{†}}$$$A positive integer $$$x$$$ is composite if it has at least one other divisor besides $$$1$$$ and $$$x$$$. For example, $$$6$$$ is composite because $$$2$$$ is a divisor of it, while $$$1$$$ and $$$5$$$ are not.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 100$$$). The description of the test cases follows.
The only line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$).
For each test case, if no suitable permutation exists, print a single integer $$$-1$$$.
Otherwise, print $$$n$$$ integers $$$p_1, p_2, \ldots, p_n$$$ representing a suitable permutation.
If there are multiple solutions, print any of them.
3145
-14 3 2 14 5 3 1 2
In the first test case, it can be shown that no suitable permutation exists.
In the second test case, the values of $$$i\cdot p_i$$$ are $$$4$$$, $$$6$$$, $$$6$$$, and $$$4$$$, respectively, which are all composite.
| Name |
|---|


