alice-bob-and-xor_16973
Bob has just learned bit manipulation and is very excited about it. He goes to his friend Alice to show off his skills who is new to programming, and thus Bob challenges Alice to solve the following problem. Given two positive integers L and R, find L ^ (L+1) ^ (L+2) ^ ....... ^ (R-1) ^ R.

Alice needs to answer k such queries.
Since Alice is new to programming, she seeks your help.

NOTE: Here a^b represents XOR of 2 numbers a and b.

Input Format :
The first line contains a number k, the number of queries.
Each of the next k lines, contain two positive integers L and R.

Output Format:
For each query, output a single line, the required answer.

Constraints:

1 ≤ k ≤ 10^5

1 ≤ L ≤ R ≤ 10^9

SAMPLE INPUT
2
2 3
3 5

SAMPLE OUTPUT
1
2

Explanation

For the first query, 2^3 = 1

For the second query, 3^4^5 = 2
def f(a):
    res=[]
    res.append(a)
    res.append(1)
    res.append(a+1)
    res.append(0)
    return res[a%4]

if __name__=='__main__':
    T = int(raw_input())
    for i in range(T):
        M,N=map(int,raw_input().split())
        print f(N)^f(M-1)