XOR Triples

No attempts yetTime limit5sMemory limit256 MB

Problem

Choose distinct integers from 1 to NN and collect them into one sequence. For every choice of three distinct chosen numbers aa, bb, cc, the value abca \oplus b \oplus c must not be 0, where \oplus is the bitwise exclusive or (XOR).

Find a sequence of maximum length that satisfies this condition.

Input

The first line contains the number of test cases TT (1T1001 \leq T \leq 100).

Each of the next TT lines contains one integer NN (1N201 \leq N \leq 20).

Output

Print the answer for each test case on two lines.

  • The first line holds the length of the sequence.
  • The second line holds the sequence sorted in increasing order, separated by single spaces.

If several sequences reach the maximum length, print only the one that is lexicographically smallest after sorting in increasing order.