The nonempty prefix XORs of an array of length $$$m$$$ are the values $$$a_1 \oplus a_2 \oplus \cdots \oplus a_k$$$ where $$$1 \le k \le m$$$ and $$$\oplus$$$ denotes the bitwise XOR operation.
You are given an integer $$$n$$$. Output a permutation$$$^{\text{∗}}$$$ of the integers from $$$0$$$ to $$$2^n-1$$$ such that the MEX$$$^{\text{†}}$$$ of all nonempty prefix XORs is maximized.
$$$^{\text{∗}}$$$A permutation of the integers from $$$0$$$ to $$$2^n-1$$$ is an array consisting of $$$2^n$$$ distinct integers from $$$0$$$ to $$$2^n-1$$$ in arbitrary order. For example, $$$[2,\,3,\,1,\,0]$$$ is a permutation, but $$$[1,\,1]$$$ is not a permutation ($$$1$$$ appears twice in the array), and $$$[1,\,2,\,4,\,0]$$$ is also not a permutation (the length is $$$4$$$ but there is $$$4$$$ in the array).
$$$^{\text{†}}$$$The minimum excluded (MEX) of a collection of integers $$$c_1, c_2, \ldots, c_k$$$ is defined as the smallest non-negative integer $$$x$$$ which does not occur in the collection $$$c$$$.
The only line of input contains a single integer $$$n$$$ ($$$2 \le n \le 20$$$).
Output $$$2^n$$$ integers which are a permutation such that the MEX of all nonempty prefix XORs is maximized.
If there are multiple solutions, you may print any.
2
0 1 3 2
3
0 1 2 5 3 7 6 4
In the first test case, the prefix XORs are $$$[0, 1, 2, 0]$$$, so the MEX is $$$3$$$, which is the maximum possible.
In the second test case, the prefix XORs are $$$[0, 1, 3, 6, 5, 2, 4, 0]$$$, so the MEX is $$$7$$$, which is the maximum possible.