Problem: You are given an array consisting of nonnegative integers.
Let's define the prefix OR array as the array , where represents the bitwise OR operation. In other words, the array is formed by computing the of every prefix of .
You are asked to rearrange the elements of the array in such a way that its prefix OR array is lexicographically maximum.
An array is lexicographically greater than an array if in the first position where and differ, .
Input Format: The first line of the input contains a single integer () — the number of test cases. The description of test cases follows.
The first line of each test case contains a single integer () — the length of the array .
The second line of each test case contains nonnegative integers ().
It is guaranteed that the sum of over all test cases does not exceed .
Output Format: For each test case print integers — any rearrangement of the array that obtains the lexicographically maximum prefix OR array.