F. Try a try, AC is OK
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

MCPlayer542 is working on a problem.

Since the problem is so difficult, he can't just write the correct solution, but instead writes $$$n$$$ different codes, where the $$$i$$$-th code can get $$$g_i$$$ points.

With time running out, MCPlayer542 was going to just hand the code in haphazardly. However, he realizes that due to the special rules of the contest, he must submit twice, and the total score he gets will be the bitwise AND operation of the scores of the two submissions.

Formally, if he submits the $$$i$$$-th and $$$j$$$-th code in the two submissions, the score is $$$g_i\& g_j$$$, where $$$\&$$$ denotes a bitwise AND operation.

He wants to know the highest score he can get.

Input

Each test contains multiple test cases. The first line of input contains a single integer $$$t$$$($$$1\le t\le 2\times 10^5$$$) — the number of test cases.

The first line of each test case contains a single integer $$$n$$$($$$1\le n \le 2\times 10^5$$$) — the number of codes.

The next line contains $$$n$$$ integers $$$g_1,\ g_2,\ \ldots,\ g_n$$$($$$0 \le g_i \lt 2^{30}$$$), separated by single spaces.

It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2\times 10^5$$$.

Output

For each test case, output a single integer in a line, denoting the answer.

Example
Input
2
3
10 4 15
4
10 10 5 4
Output
15
10
Note

In the first test case, you can submit the third code twice.

In the second test case, you can submit the first and the second codes.