# Life Goes On! abcdef123 MBSTU CSE Junior IDPC 2k2...
Limits 1s, 128 MB

Skinny Pete lives far away from locality on his own. Two days ago he met Badger in a forest who was looking for knowledges to solve a problem. Skinny Pete and Badger bonded immediately, as Pete never had any friends, it was refreshing for him to have human companion. So, Skinny Pete decides to help Badger by solving his problem.

Badger has a machine which produces an array size of $R-L+1$ containing all integers from $L$ to $R$ exactly once i.e. $L,L+1,L+2,….,R-2,R-1,R$. He will have to find a minimum integer $X(0 \leq X \leq L)$ which will be subtracted from every integers of array exactly once. After that, resulting array’s total $XOR$ value must be $0$. By using his divine knowledge, Skinny Pete gives him the answer or tell him there’s no such $X$. After hearing the solution, Badger returns to his family and Skinny Pere becomes lonely again.

Now, you have the machine Badger used to have. You have to find the answer to the problem or tell them there isn’t one. Note that you have to minimize the value of $X$.

## Input

The first line will contain an integer $T(1 \leq T \leq 10^5)$.

Each line will contain two integers $L, R (0 \leq L \leq R \leq 10^{18})$.

## Output

For each test case, print a single line containing an integer $X(0 \leq X \leq L)$ and it will have to be as minimum as possible. If there is no answer, print $-1$.

## Sample

InputOutput
3
4 7
7 10
11 44355

0
1
-1


In first test case, the array is $[4,5,6,7]$. $XOR$ of the array is $0$. So we don’t have to subtract anything.

In second test case, $XOR$ of the array is $12$. If we subtract $1$ from every element of the array, $XOR$ of the array will become $0$.

### Submit 