
You do not need to print anything; it has already been taken care of. Just implement the given function.
The first line of input contains T, the number of test cases.
For each test case, the first line contains a number ‘N’, which is the size of the array.
The next line contains N space-separated integers, that denote the values of the elements in the array.
The output of each test case contains ‘N’ integers, denoting the order in which the elements should be kept such that the result is largest.
1 <= T <= 5
1 <= N <= 3000
1 <= data <= 10^5
where ‘T’ is the number of test cases, N is the number of elements in the array.
Time Limit : 1sec
To maximize the sum of XOR values between adjacent elements, we observe the following:
Algorithm: