Cengiz recently learned Fibonacci numbers and now he is studying different algorithms to find them. After getting bored of reading them, he came with his own new type of numbers that he named XORinacci numbers. He defined them as follows:   $f(0) = a$;  $f(1) = b$;  $f(n) = f(n-1) \oplus f(n-2)$ when $n > 1$, where $\oplus$ denotes the bitwise XOR operation. 

You are given three integers $a$, $b$, and $n$, calculate $f(n)$.

You have to answer for $T$ independent test cases.


-----Input-----

The input contains one or more independent test cases.

The first line of input contains a single integer $T$ ($1 \le T \le 10^3$), the number of test cases.

Each of the $T$ following lines contains three space-separated integers $a$, $b$, and $n$ ($0 \le a, b, n \le 10^9$) respectively.


-----Output-----

For each test case, output $f(n)$.


-----Example-----
Input
3
3 4 2
4 5 0
325 265 1231232

Output
7
4
76



-----Note-----

In the first example, $f(2) = f(0) \oplus f(1) = 3 \oplus 4 = 7$.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '#\n# Yet I\'m feeling like\n# \tThere is no better place than right by your side\n# \t\tI had a little taste\n# \t\t\tAnd I\'ll only spoil the party anyway\n# \t\t\t\t\'Cause all the girls are looking fine\n# \t\t\t\t\tBut you\'re the only one on my mind\n\n\nimport sys\n# import re\n# inf = float("inf")\n# sys.setrecursionlimit(1000000)\n\n# abc=\'abcdefghijklmnopqrstuvwxyz\'\n# abd={\'a\': 0, \'b\': 1, \'c\': 2, \'d\': 3, \'e\': 4, \'f\': 5, \'g\': 6, \'h\': 7, \'i\': 8, \'j\': 9, \'k\': 10, \'l\': 11, \'m\': 12, \'n\': 13, \'o\': 14, \'p\': 15, \'q\': 16, \'r\': 17, \'s\': 18, \'t\': 19, \'u\': 20, \'v\': 21, \'w\': 22, \'x\': 23, \'y\': 24, \'z\': 25}\nmod,MOD=1000000007,998244353\n# vow=[\'a\',\'e\',\'i\',\'o\',\'u\']\n# dx,dy=[-1,1,0,0],[0,0,1,-1]\n\n# from collections import deque, Counter, OrderedDict,defaultdict\n# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace\n# from math import ceil,floor,log,sqrt,factorial,pow,pi,gcd,log10,atan,tan\n# from bisect import bisect_left,bisect_right\n# import numpy as np\n\n\ndef get_array(): return list(map(int , sys.stdin.readline().strip().split()))\ndef get_ints(): return list(map(int, sys.stdin.readline().strip().split()))\ndef input(): return sys.stdin.readline().strip()\n\nT=int(input())\nwhile T>0:\n    a,b,n=get_ints()\n    n=n%3\n    if n==0:\n        print(a)\n    elif n==1:\n        print(b)\n    else:\n        print(a^b)\n    T-=1\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13735