#C4800. Harvest Festival Sequence
Harvest Festival Sequence
Harvest Festival Sequence
During the annual harvest festival, participants are required to create a unique sequence from (1) to (n) that adheres to traditional rules. Specifically, if (n = 1), the sequence is simply [1]. For (n = 2), it is impossible to form a valid sequence so the output should be -1. For odd (n) (with (n \ge 3)), the descending order (n, n-1, \ldots, 1) is accepted. For even (n) (with (n \ge 4)), the valid sequence is constructed by listing all even numbers in ascending order followed by all odd numbers in ascending order, i.e., (2,4,6,\ldots,n,1,3,5,\ldots). The numbers in the sequence must be separated by a single space, and each test case’s result should be printed on a new line.
inputFormat
The first line of the input contains an integer (T), representing the number of test cases. Each of the next (T) lines contains one integer (n).
outputFormat
For each test case, output the corresponding sequence in a single line. If a valid sequence cannot be constructed (i.e., when (n = 2)), output -1.## sample
4
1
2
3
4
1
-1
3 2 1
2 4 1 3
</p>