You are given a sequence of n distinct nonnegative integers a_1,a_2,…,a_n.
For the given sequence, it is guaranteed that for all nonnegative numbers x, if there is some i such that a\_i \ \\&\ x = x, then there is a j such that a_j=x. Here, \\& refers to the bitwise AND operator.
Find a permutation b_1,b_2,…,b_n of a_1,a_2,…,a_n such that b\_i \ \\&\ a\_i = 0 for all i. If there are multiple solutions, find any such permutation. It is guaranteed that a solution always exists.
The first line of input contains an integer n (1≤n<218), which is the number of integers in the permutation.
Each of the next n lines contains an integer a_i (0≤a_i<260), which is the input sequence, in order of i. All of the a_i's are guaranteed to be distinct. For all nonnegative numbers x, if there is some i such that a\_i \ \\&\ x = x, then there is a j such that a_j=x.
Output n lines, each containing a single integer, which are the b_i's, in order of i.