## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Permutation AND CodeChef Solution | CodeChef Problem Solution 2022

Chef's last task in his internship requires him to construct $2$ permutations, each having length $N$, such that the bitwise AND of each pair of elements at every index is the same.

Formally, if the permutations are $A$ and $B$, then, the value ${A}_{i}\mathrm{&}{B}_{i}$ must be constant over all $1\le i\le N$.

Help Chef by providing him $2$ such permutations. If it is not possible to construct such permutations, print $-1$ instead.

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.

• Each test case contains of a single line of input, a single integer $N$ denoting the size of the required permutations.

### Output Format

• If there are valid permutations that satisfy the required condition, then:
• In the first line, output $N$ space-separated integers denoting the permutation $A$.
• In the second line, output $N$ space-separated integers denoting the permutation $B$.

• If there is no valid pair of permutations, print -1 in a single line.

### Constraints

• $1\le T\le 1000$
• $1\le N\le {10}^{5}$
• Sum of $N$ over all test cases does not exceed $2\cdot {10}^{5}$