Claris and XOR

Time Limit: 1000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5661
64-bit integer IO format: %I64d      Java class name: Main

Description

Claris loves bitwise operations very much, especially XOR, because it has many beautiful features. He gets four positive integers $a,b,c,d$ that satisfies $a\leq b$ and $c\leq d$. He wants to choose two integers $x,y$ that satisfies $a\leq x\leq b$ and $c\leq y\leq d$, and maximize the value of $x~XOR~y$. But he doesn't know how to do it, so please tell him the maximum value of $x~XOR~y$.

Input

The first line contains an integer $T\left(1\leq T\leq10,000\right)$——The number of the test cases.
For each test case, the only line contains four integers $a,b,c,d\left(1\leq a,b,c,d\leq10^{18}\right)$. Between each two adjacent integers there is a white space separated.

Output

For each test case, the only line contains a integer that is the maximum value of $x~XOR~y$.

Sample Input

2
1 2 3 4
5 7 13 15

Sample Output

6
11

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .