#K48527. Thrilling Sequence Generator

    ID: 28440 Type: Default 1000ms 256MiB

Thrilling Sequence Generator

Thrilling Sequence Generator

Given an integer \(N\), generate a thrilling sequence of length \(N\). A sequence \(a_1, a_2, \dots, a_N\) is said to be thrilling if the sum of the absolute differences between adjacent elements, i.e., \(|a_2-a_1| + |a_3-a_2| + \dots + |a_N - a_{N-1}|\), equals \(N-1\). The simplest thrilling sequence for \(N \geq 2\) is the natural number sequence \(1, 2, \dots, N\>.

When \(N=1\), no valid thrilling sequence exists so you should output -1.

inputFormat

The first line of input contains an integer \(T\) representing the number of test cases. Each of the following \(T\) lines contains a single integer \(N\), which represents the length of the sequence to be generated.

outputFormat

For each test case, output a single line. If a thrilling sequence exists (when \(N \geq 2\)), print the sequence of numbers separated by a single space. If no thrilling sequence exists (i.e., when \(N=1\)), output -1.

## sample
2
3 5
1 2 3

1 2 3 4 5

</p>