#P1554B. Cobb
Cobb
Description
You are given integers and an integer . Find the maximum value of over all pairs of integers with . Here, is the bitwise OR operator.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers () and ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases doesn't exceed .
For each test case, print a single integer — the maximum possible value of .
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains two integers () and ().
The second line of each test case contains integers ().
It is guaranteed that the sum of over all test cases doesn't exceed .
Output
For each test case, print a single integer — the maximum possible value of .
Note
Let .
In the first test case,
- .
- .
- .
So the maximum is .
In the fourth test case, the maximum is .