#P1299A. Anu Has a Function
Anu Has a Function
No submission language available for this problem.
Description
Anu has created her own function : where denotes the bitwise OR operation. For example, . It can be proved that for any nonnegative numbers and value of is also nonnegative.
She would like to research more about this function and has created multiple problems for herself. But she isn't able to solve all of them and needs your help. Here is one of these problems.
A value of an array is defined as (see notes). You are given an array with not necessarily distinct elements. How should you reorder its elements so that the value of the array is maximal possible?
The first line contains a single integer ().
The second line contains integers (). Elements of the array are not guaranteed to be different.
Output integers, the reordering of the array with maximum value. If there are multiple answers, print any.
Input
The first line contains a single integer ().
The second line contains integers (). Elements of the array are not guaranteed to be different.
Output
Output integers, the reordering of the array with maximum value. If there are multiple answers, print any.
Samples
Note
In the first testcase, value of the array is .
is also a valid answer.