409897: GYM103828 J Even Adjacent Product
Description
A permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[1, 2, 4, 3]$$$ is a permutation, but $$$[1, 3, 3, 2]$$$ is not a permutation because $$$3$$$ appears twice in the array, and $$$[1, 2, 4, 5]$$$ is also not a permutation because $$$n = 4$$$ but there is $$$5$$$ in the array.
Your task is to construct a permutation of length $$$n$$$, such that every pair of adjacent numbers in the permutation has an even product.
More formally, for each $$$i$$$ $$$(1 \le i < n)$$$, the following condition must hold:
- $$$(p_i \times p_{i + 1})$$$ is even.
The first line of input contains a single integer $$$T$$$, the number of test cases.
The next $$$T$$$ lines each contains a single integer $$$(1 \le n \le 10^{5})$$$, the size of the permutation.
The sum of $$$n$$$ over all testcases doesn't exceed $$$10^5$$$.
OutputPrint $$$T$$$ lines, each containing a permutation of $$$n$$$ space-separated integers such that every pair of adjacent numbers in the permutation has an even product. if there are multiple answers print any of them.
ExampleInput2 6 12Output
2 1 6 5 4 3 2 9 8 7 4 5 6 1 12 3 10 11