You are given an array of positive integers a_1, a_2, \dots, a_n.
In one move, you may choose any two distinct indices i \ne j and replace
where denotes the bitwise AND operation.
You may repeat this operation arbitrarily many times.
For each test case, determine the smallest integer such that it is possible to make appear at least times in the array.
The first line contains a single integer (1 \le t \le 1000) — the number of test cases.
The first line of each test case contains an integer (3 \le n \le 10^6) — the size of the array.
The second line of each test case contains integers a_1, a_2, \dots, a_n (1 \le a_i \le 10^9) — the elements of the array.
It is guaranteed that the sum of over all test cases does not exceed 10^6.
For each test case, print a single integer — the smallest value that can appear at least times after performing the operation any number of times.
Example 1
In the first test case, we already have elements, of which is the smallest value.
In the second test case, since 1 \& 2 = 0, the array becomes: [0,0,3,4,5] and since 3 \& 0 = 0, the array further becomes: [0,0,0,4,5] Thus, there are zeros in the array, which is the minimum possible.
Subtask ( points) : (a_1=a_2=...=a_n)
Subtask ( points) : (1 \le \sum n \le 1000)
Subtask ( points) : one bit position is set in every element in .
Subtask ( points) : There exist exactly two distinct integers in .
Subtask ( points) : No additional constraints.