A. OR what?
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

For any sequence $$$(b_1, b_2, \ldots, b_m)$$$ of integers, let's define the beauty of the sequence as $$$b_1$$$ $$$|$$$ $$$b_2$$$ $$$|$$$ $$$b_3$$$ $$$\cdots$$$ $$$|$$$ $$$b_m$$$.

Here, $$$|$$$ denotes the bitwise OR operator.

You are given an array of $$$n$$$ positive integers $$$[a_1, a_2, \ldots, a_n]$$$.

Your task is to determine the minimum beauty value over all the non-decreasing subsequences$$$^{\text{∗}}$$$ of the array $$$a$$$.

$$$^{\text{∗}}$$$A subsequence of an array is a sequence that can be obtained by removing several (possibly zero) elements from the original array.

A sequence $$$(b_1, b_2, \ldots, b_m)$$$ is non-decreasing if $$$b_1 \le b_2 \le b_3 \cdots \le b_m$$$.

Input

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases.

The first line of each testcase contains a single integer $$$n$$$ ($$$1 \le n \le 100$$$) — the length of the array $$$a$$$.

The second line of each testcase contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^6$$$) — the elements of the array.

Output

For each testcase, output a single integer — the minimum beauty value over all the non-decreasing subsequences of the given array.

Example
Input
3
4
1 1 1 1
5
9 6 7 6 8
4
4 8 4 4
Output
1
6
4
Note

For the first testcase, consider the subsequence $$$(1, 1, 1)$$$. The beauty of this subsequence is $$$1$$$ $$$|$$$ $$$1$$$ $$$|$$$ $$$1$$$ $$$=$$$ $$$1$$$. This is the minimum possible value over all subsequences.