You are given an integer
. Construct a permutation of length which is attractive.
A permutation is called attractive if the bitwise XOR of all absolute differences of adjacent pairs of elements is equal to .
Formally, a permutation of length is said to be attractive if:
where denotes the bitwise XOR operation.
Output any attractive permutation of length . If no attractive permutation exists, print instead.
Note: A permutation of length is an array such that every integer from to occurs exactly once in . For example, and are permutations of length , but , , and are not.
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follows.
- Each test case consists of a single line of input, containing one integer .
Output Format
For each test case, output on a single line an attractive permutation of integers, or if no attractive permutation exists.
Constraints
- Sum of over all cases won't exceed .
Sample Input 1
2
3
6
Sample Output 1
3 2 1
5 2 3 6 4 1
Explanation
Test Case :
Note that there are other correct answers — for example, would also be accepted as correct.
Test Case :
ConversionConversion EmoticonEmoticon