Vova always wants to learn something new. A lot of things he asks Lesha. This time Lesha gave him the following task...
He was given an array of n integers a1, a2, ..., an. It is necessary to find a permutation p such that
will be maximal. Vova has not yet come up with a solution, but you got a chance to come up with a solution faster than him.
Recall that the operation
, it is also XOR, which is exclusive OR. This operation corresponds to the operator ^ in programming languages C++ and Java. In the Pascal language, the operator xor is responsible for this operation. For numbers 5 and 3, the result of the operation will be:
.
The first line of input contains an integer n (1 ≤ n ≤ 8) — the size of the array A.
In the next line there are n integers a1, a2, ..., an (1 ≤ ai ≤ 109) — the elements of the array A.
In a single line output n integers p1, p2, ..., pn (1 ≤ pi ≤ n) — permutation at which the maximum XOR-sum of the array is reached. We recall that all elements of the permutation are different. If there are several correct answers, you can output any of them.
4
21 2 2018 42
2 4 1 3
| Name |
|---|


