In order to celebrate Twice's 5th anniversary, Tzuyu and Sana decided to play a game.

Tzuyu gave Sana two integers $a$ and $b$ and a really important quest.

In order to complete the quest, Sana has to output the smallest possible value of ($a \oplus x$) + ($b \oplus x$) for any given $x$, where $\oplus$ denotes the bitwise XOR operation. 


-----Input-----

Each test contains multiple test cases. The first line contains the number of test cases $t$ ($1 \le t \le 10^{4}$). Description of the test cases follows.

The only line of each test case contains two integers $a$ and $b$ ($1 \le a, b \le 10^{9}$).


-----Output-----

For each testcase, output the smallest possible value of the given expression.


-----Example-----
Input
6
6 12
4 9
59 832
28 14
4925 2912
1 1

Output
10
13
891
18
6237
0



-----Note-----

For the first test case Sana can choose $x=4$ and the value will be ($6 \oplus 4$) + ($12 \oplus 4$) = $2 + 8$ = $10$. It can be shown that this is the smallest possible value.

Source: codeforces | Difficulty: EASY
Tags: Bit manipulation

Mathematics

Greedy algorithms


Solutions:
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	print(n ^ k)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


total = int(input())
nums = [[int(n) for n in input().split()] for i in range(total)]
for n in nums:
	bin1 = bin(n[0])[2:]
	bin2 = bin(n[1])[2:]
	maxlen = max(len(bin1), len(bin2))
	bin1 = bin1.zfill(maxlen)
	bin2 = bin2.zfill(maxlen)
	print(int(''.join([str(int(bin1[i]) ^ int(bin2[i])) for i in range(maxlen)]), 2))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = a & b
	print((a ^ c) + (b ^ c))


from sys import stdin

def main(a, b):
	print(a ^ b)
t = int(stdin.readline())
cases = [[int(s) for s in stdin.readline().split()] for _ in range(t)]
for (a, b) in cases:
	main(a, b)


for i in range(int(input())):
	(t, k) = input().split()
	(t, k) = (int(t), int(k))
	print(t ^ k)


import sys, math, cmath, time
start_time = time.time()

def solve():
	(a, b) = invr()
	print(a ^ b)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(1, t + 1):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def power_two(x):
	return x and (not x & x - 1)

def ceil(a, b):
	return -(-a // b)

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


T = int(input())
while T:
	(a, b) = map(int, input().split())
	print(a ^ 0 + b ^ 0)
	T -= 1


import math, sys, os
from collections import defaultdict, deque, OrderedDict, Counter
import bisect as bi
from io import BytesIO, IOBase
mod = 10 ** 9 + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def minp():
	return map(int, sys.stdin.readline().rstrip().split())

def linp():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def inp():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))

def BinarySearch(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	else:
		return -1

def gcd(a, b):
	return math.gcd(a, b)

def is_prime(n):
	if n < 5 or n & 1 == 0 or n % 3 == 0:
		return 2 <= n <= 3
	s = (n - 1 & 1 - n).bit_length() - 1
	d = n >> s
	for a in [2, 325, 9375, 28178, 450775, 9780504, 1795265022]:
		p = pow(a, d, n)
		if p == 1 or p == n - 1 or a % n == 0:
			continue
		for _ in range(s):
			p = p * p % n
			if p == n - 1:
				break
		else:
			return False
	return True

def mulinverse(a):
	return pow(a, mod - 2, mod)
for _ in range(inp()):
	(a, b) = minp()
	if a > b:
		print(b ^ a)
	else:
		print(a ^ b)


import sys
input = sys.stdin.readline
import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split()))
	x = a & b
	print((a ^ x) + (b ^ x))


tc = int(input())
for case in range(tc):
	(a, b) = map(int, input().split(' '))
	print(a ^ b)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

def solve():
	(a, b) = mints()
	x = a & b
	print((a ^ x) + (b ^ x))
for i in range(mint()):
	solve()


t = int(input())
for ti in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import sys
input = sys.stdin.readline
for f in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


from sys import *
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
for _ in range(int(input())):
	(a, b) = get_int()
	print(a ^ 0 + b ^ 0)


t = int(input())
for _ in range(t):
	res = 0
	(a, b) = map(int, input().split())
	print(a ^ b)


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for _ in range(int(input())):
	(A, B) = list(map(int, input().split()))
	X = findX(A, B)
	print((A ^ X) + (B ^ X))


try:
	x = int(input())
	for _ in range(x):
		a = list(map(int, input().split()))
		c = a[0] & a[1]
		d = (a[0] ^ c) + (a[1] ^ c)
		print(d)
except:
	pass


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ct = 0
	ans = 0
	while a != 0 or b != 0:
		if a % 2 != b % 2:
			ans += 2 ** ct
		a //= 2
		b //= 2
		ct += 1
	print(ans)


n = int(input(''))
l = []
for i in range(n):
	s = input('')
	(a, b) = s.split(' ')
	a = int(a)
	b = int(b)
	temp = a & b
	l.append((a ^ temp) + (b ^ temp))
print(*l, sep='\n')


T = int(input())
for Tid in range(T):
	(a, b) = map(int, input().split())
	print(a ^ b)


import sys
import math

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(a, b) = get_ints()
	print(a ^ b)


from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
from collections import Counter
from math import sqrt
import collections
import math
import heapq
import re

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		print(a ^ b)
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	(a, b) = ip()
	print((a ^ (a | b)) + (b ^ (a | b)))


import math
from collections import Counter, defaultdict, deque

def f(a, b):
	pos = 0
	x = 0
	while a or b:
		if a & 1 and b & 1:
			x += 1 << pos
		a >>= 1
		b >>= 1
		pos += 1
	return x
t = int(input())
result = []
for i in range(t):
	(a, b) = list(map(int, input().split()))
	x = f(a, b)
	result.append((a ^ x) + (b ^ x))
for i in range(t):
	print(result[i])


for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	print((a | b) - (a & b))


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

def solve(a, b):
	return a ^ b
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(solve(a, b))


n = int(input())
for i in range(0, n):
	p = input().rstrip().split(' ')
	a = int(p[0])
	b = int(p[1])
	C = list(bin(a))
	D = list(bin(b))
	del C[0]
	del C[0]
	del D[0]
	del D[0]
	if len(C) > len(D):
		F = len(C) - len(D)
		for j in range(0, F):
			D.insert(0, 0)
	else:
		F = len(D) - len(C)
		for j in range(0, F):
			C.insert(0, 0)
	V = []
	for j in range(0, len(C)):
		if int(C[j]) == int(D[j]):
			V.append(0)
		else:
			V.append(1)
	X = 0
	ans = 0
	for j in range(len(V) - 1, -1, -1):
		if V[j] == 1:
			ans = ans + 2 ** X
		X += 1
	print(ans)


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(a, b) = iia()
	t = a & b
	print((a ^ t) + (b ^ t))


import bisect

def solve(a, b):
	bin_a = str(bin(a))[2:]
	bin_b = str(bin(b))[2:]
	l = max(len(bin_a), len(bin_b))
	bin_a = bin_a.zfill(l)
	bin_b = bin_b.zfill(l)
	num = 0
	for j in range(l):
		if bin_b[j] != bin_a[j]:
			num += 2 ** (l - 1 - j)
	return num
	pass
t = int(input())
ans = []
for i in range(t):
	s = [int(x) for x in input().split()]
	a = s[0]
	b = s[1]
	ans.append(solve(a, b))
for test in ans:
	print(test)


t = int(input())
for i in range(t):
	(n, m) = map(int, input().split())
	print(n ^ m)


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(a ^ b)


t = int(input())
for _ in range(t):
	xy = input().split()
	x = int(xy[0])
	y = int(xy[1])
	print(x ^ y)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
import bisect
from collections import Counter
import bisect
import heapq as h
from collections import defaultdict
from collections import deque

def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = findX(a, b)
	print((a ^ x) + (b ^ x))


import sys

def gt():
	return list(map(int, input().split()))
(t,) = gt()
while t:
	t -= 1
	(a, b) = gt()
	m = a & b
	print((a ^ m) + (b ^ m))


from collections import defaultdict
t = int(input())
for _ in range(t):
	(a, b) = [int(i) for i in input().split()]
	m = max(a, b)
	ans = (a ^ m) + (b ^ m)
	print(ans)


import math
t = int(input())
for _ in range(t):
	(a, b) = [int(x) for x in input().split()]
	x = 1
	ans = 0
	while x <= a or x <= b:
		if x & a != x & b:
			ans += x
		x *= 2
	print(ans)


import sys
T = int(sys.stdin.readline())
for i in range(T):
	(a, b) = map(int, sys.stdin.readline().split())
	print(a ^ b)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x ^ y)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	a = '{0:030b}'.format(a)
	b = '{0:030b}'.format(b)
	ans = 0
	c = 1
	for i in range(29, -1, -1):
		if a[i] != b[i]:
			ans += c
		c *= 2
	print(ans)


a = input()
a = int(a)
c = 0
for i in range(a):
	(a, b) = input().split(' ')
	(a, b) = (int(a), int(b))
	c = a ^ b
	print(c)


import os, sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		print(a ^ b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = 0
	ans = a + b
	while True:
		if 1 << x & a and 1 << x & b:
			ans -= 2 * 2 ** x
		x += 1
		if 2 ** x > a or 2 ** x > b:
			break
	print(ans)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x ^ y)


for x in range(int(input())):
	(a, b) = map(int, input().split())
	if a < b:
		print((a ^ a) + (b ^ a))
	else:
		print((a ^ b) + (b ^ b))


def xorwice():
	test_cases = int(input())
	for t in range(test_cases):
		(a, b) = [int(x) for x in input().split(' ')]
		a_binary = '{0:32b}'.format(a)
		b_binary = '{0:32b}'.format(b)
		x = 1
		nr = 0
		for i in range(len(a_binary) - 1, -1, -1):
			if a_binary[i] == '1' and b_binary[i] == '1':
				nr += x
			x *= 2
		print((a ^ nr) + (b ^ nr))
xorwice()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)
for _ in range(INT()):
	(a, b) = MAP()
	K = 32
	x = 0
	for k in range(K):
		if 1 << k & a and 1 << k & b:
			x |= 1 << k
	ans = (a ^ x) + (b ^ x)
	print(ans)


import math
import sys
from collections import OrderedDict

class Graph:

	def __init__(self, Nodes, is_directed=False):
		self.nodes = Nodes
		self.adj_list = {}
		self.is_directed = is_directed
		for node in self.nodes:
			self.adj_list[node] = []

	def add_edge(self, u, v):
		self.adj_list[u].append(v)

	def print_graph(self):
		for node in self.nodes:
			print(node, '->', self.adj_list[node])

	def degree_node(self, node):
		return len(self.adj_list[node])

	def dfsUTIL(self, v, visited, parents=[]):
		visited[v] = True
		for i in self.adj_list[v]:
			if visited[i] == False:
				self.dfsUTIL(i, visited, parents)
				parents.append(i)

	def dfs(self, v):
		visited = [False] * (max(self.adj_list) + 1)
		parents = [v]
		self.dfsUTIL(v, visited, parents)
		return parents

def dict_sort(ans):
	ans = sorted(ans.items(), reverse=True, key=lambda kv: kv[1])

def is_prime(n):
	if n == 1:
		return 0
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def swap(a, b):
	temp = a
	a = b
	b = temp

def seive_primes(n):
	flag = [0] * (n + 10)
	flag[1] = flag[0] = 1
	i = 2
	while i * i <= n + 1:
		if flag[i] == 0:
			j = i * i
			while j <= n + 1:
				flag[j] = 1
				j += i
		i += 1
	return flag

def factors(n):
	d = {}
	while n % 2 == 0:
		if 2 in d:
			d[2] += 1
		else:
			d[2] = 1
		n /= 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
			n /= i
	n = int(n)
	if n > 1:
		d[n] = 1
	return d

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def alphabates():
	return 'abcdefghijklmnopqrstuvwxyz'

def binary_search(ls, n, flag):
	low = 0
	hi = n - 1
	while low <= hi:
		mid = (low + hi) // 2
		if ls[mid] == flag:
			return mid
		elif ls[mid] > flag:
			hi = mid - 1
		else:
			low = mid + 1
	return -1

def qdrt(a, b, c):
	chk = b * b - 4 * a * c
	if chk >= 0:
		ans1 = (-b + chk ** 0.5) / (2 * a)
		ans2 = (-b - chk ** 0.5) / (2 * a)
		return [int(ans1), int(ans2)]
	return -1

def permutation(n, r):
	if n < r:
		return 0
	ans = 1
	for i in range(n - r + 1, n + 1):
		ans *= i
	return ans

def combination(n, r):
	if n < r:
		return 0
	ans = 1
	for i in range(r):
		ans *= n - i
	div = 1
	for i in range(2, r + 1):
		div *= i
	return ans // div

def ispow2(n):
	ans = int(math.log(n, 2))
	if 2 ** ans == n:
		return True
	return False

def sumn(n):
	return n * (n + 1) // 2

def arrinp():
	ls = list(map(int, input().split()))
	return ls

def mult_inp():
	return map(int, input().split())

def main():
	(a, b) = mult_inp()
	print(a ^ 0 + b ^ 0)
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k = a & b
	ans = (a ^ k) + (b ^ k)
	print(ans)


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()
for _ in range(INT()):
	(a, b) = MAP()
	x = a & b
	print((a ^ x) + (b ^ x))


import itertools
import math
import sys
from collections import defaultdict

def is_debug():
	return '--debug' in sys.argv

def stdin_wrapper():
	data = '6\n6 12\n4 9\n59 832\n28 14\n4925 2912\n1 1\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return inputWrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(a, b):
	bina = bin(a)[2:]
	binb = bin(b)[2:]
	if len(bina) > len(binb):
		binb = '0' * (len(bina) - len(binb)) + binb
	elif len(binb) > len(bina):
		bina = '0' * (len(binb) - len(bina)) + bina
	res = []
	for i in reversed(range(len(binb))):
		if binb[i] == '1' and bina[i] == '1':
			res.append('1')
		else:
			res.append('0')
	res = ''.join([x for x in reversed(res)])
	d = int(res, base=2)
	return (a ^ d) + (b ^ d)
t = get(int)
for _ in range(t):
	(a, b) = get_arr(int)
	print(*solve(a, b))


import math
t = int(input())
for _ in range(t):
	(a, b) = list(map(int, input().split(' ')))
	m = min(a, b)
	v = 0
	while m > 0:
		l = math.log2(m)
		s = 1 << int(l)
		v = v + s
		m = m - s
	print((a ^ v) + (b ^ v))


import sys
input = sys.stdin.readline
t = int(input())
for t1 in range(t):
	(a, b) = list(map(int, input().split(' ')))
	a1 = bin(a)[2:]
	b1 = bin(b)[2:]
	z = max(len(a1), len(b1))
	a2 = '0' * (z - len(a1)) + a1
	b2 = '0' * (z - len(b1)) + b1
	a1 = []
	b1 = []
	for i in range(z):
		a1.append(a2[i])
		b1.append(b2[i])
	for i in range(z):
		if a1[i] == b1[i]:
			a1[i] = '0'
			b1[i] = '0'
	a1 = ''.join(a1)
	b1 = ''.join(b1)
	print(int(a1, 2) + int(b1, 2))


from sys import stdin
input = stdin.readline
q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	wyn = 0
	pot = 1
	while pot < 10 ** 9 + 1:
		if a ^ pot < a and b ^ pot < b:
			wyn += pot
		pot *= 2
	print((wyn ^ a) + (wyn ^ b))


import sys
input = sys.stdin.buffer.readline

def solution():
	(a, b) = map(int, input().split())
	print(a ^ b)
t = int(input())
for _ in range(t):
	solution()


t = int(input())
for i in range(t):
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[-1]
	print((a ^ a) + (a ^ b))


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	print(n ^ k)


testcases = int(input())
for testcase in range(testcases):
	temparr = input()
	temparr = temparr.split()
	a = int(temparr[0])
	b = int(temparr[1])
	ans = a ^ b
	print(ans)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	print(a ^ b)
	t -= 1


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop, nsmallest
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
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}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)

def setBitNumber(n):
	n |= n >> 1
	n |= n >> 2
	n |= n >> 4
	n |= n >> 8
	n |= n >> 16
	n = n + 1
	return n >> 1

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count

def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for _ in range(ii()):
	(a, b) = mi()
	x = findX(a, b)
	print((a ^ x) + (b ^ x))


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
t = int(input())
z = []
for i in range(t):
	arr = list(map(int, input().rstrip().split()))
	A = arr[0]
	B = arr[1]
	X = findX(A, B)
	z.append((A ^ X) + (B ^ X))
for i in z:
	print(i)


from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from math import ceil, floor, log
from collections import Counter, deque
from heapq import heappush, heappop, heapify
from itertools import permutations, product

def cin():
	return stdin.readline().rstrip()

def mapi():
	return map(int, input().split())

def veci():
	return list(map(int, input().split()))
mod = 1000000007

def solve(a, b):
	x = 0
	for i in range(32):
		if a & 1 << i and b & 1 << i:
			x ^= a & 1 << i
	ans = (a ^ x) + (b ^ x)
	return ans
for t in range(int(cin())):
	(a, b) = mapi()
	print(solve(a, b))


z = int(input())
while z:
	(a, b) = map(int, input().split())
	print(a ^ b)
	z -= 1


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = a & b
	u = a ^ c
	v = b ^ c
	print(u + v)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(ba, bb) = (str(bin(a))[2:], str(bin(b))[2:])
	ans = ''
	for i in range(1, min(len(ba), len(bb)) + 1):
		if int(ba[-i]) and int(bb[-i]):
			ans += '1'
		elif not (int(ba[-i]) or int(bb[-i])):
			ans += '0'
		else:
			ans += '0'
	ans = int(ans[::-1], 2)
	print((a ^ ans) + (b ^ ans))


def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		x = 0
		for i in range(32):
			p = a >> i & 1
			q = b >> i & 1
			x |= (p & q) << i
		print((a ^ x) + (b ^ x))
main()


tc = int(input())
for t in range(tc):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	r = (a | b) - (a & b)
	print(r)


t = int(input())
for you in range(t):
	l = input().split()
	a = int(l[0])
	b = int(l[1])
	z = a & b
	print((a ^ z) + (b ^ z))


def codeForces(a, b):
	if a == b:
		print(0)
	else:
		r1 = r2 = r3 = c = 0
		bit = '0b1'
		i = 1
		r1 = (a ^ a) + (b ^ a)
		r2 = (a ^ b) + (b ^ b)
		while not a >> i & 1:
			c += 1
			i += 1
		for i in range(c):
			bit += '0'
		bit = int(bit, 2)
		r3 = (a ^ bit) + (b ^ bit)
		print(min(r1, r2, r3))
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	if b > a:
		(a, b) = (b, a)
	codeForces(a, b)


import math
prime = [True for i in range(10 ** 6 + 1)]

def SieveOfEratosthenes(n):
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import bisect
import collections
import functools
import itertools
import math
import heapq
import random
import string

def repeat(_func=None, *, times=1):

	def decorator(func):

		@functools.wraps(func)
		def wrapper(*args, **kwargs):
			for _ in range(times):
				func(*args, **kwargs)
		return wrapper
	if _func is None:
		return decorator
	else:
		return decorator(_func)

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int, rev=False):
	return sorted(map(func, input().split()), reverse=rev)

def ml_unpack(n):
	return [int(input()) for _ in range(n)]

def range_n():
	return range(int(input()))

def getint():
	return int(input())

def getmatrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def display_matrix(mat):
	for i in range(len(mat)):
		print(mat[i])

def factor(n):
	d = collections.defaultdict(int)
	while not n % 2:
		d[2] += 1
		n //= 2
	i = 3
	while i * i <= n:
		while not n % i:
			d[i] += 1
			n //= i
		i += 2
	if n > 1:
		d[n] += 1
	return d

@repeat(times=getint())
def main():
	(a, b) = unpack()
	ans = 0
	i = 0
	(n, m) = (a, b)
	while a and b:
		if a & 1 and b & 1:
			ans += 1 << i
		a >>= 1
		b >>= 1
		i += 1
	print((n ^ ans) + (m ^ ans))
main()


from math import *
t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(a ^ b)
	t -= 1


import sys
import math
from collections import Counter, defaultdict
LI = lambda : list(map(int, input().split()))
MAP = lambda : map(int, input().split())
IN = lambda : int(input())
S = lambda : input()

def case():
	(a, b) = MAP()
	print(a ^ b)
for _ in range(IN()):
	case()


t = int(input())

def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for i in range(t):
	(A, B) = map(int, input().split())
	X = findX(A, B)
	print((A ^ X) + (B ^ X))


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	(a, b) = mint()
	print(a ^ b)
for _ in range(iinp()):
	solve()


t = int(input())
for i in range(t):
	list = [int(i) for i in input().split()]

	def minimm(a, b):
		j = 0
		x = 0
		while a or b:
			if a & 1 and b & 1:
				x += 1 << j
			a >>= 1
			b >>= 1
			j += 1
		return x
	if __name__ == '__main__':
		a = list[0]
		b = list[1]
		X = minimm(a, b)
	print((a ^ X) + (b ^ X))


try:
	from math import log2

	def findXorSum(arr, n):
		itr = max(arr)
		p = int(log2(itr)) + 1
		X = 0
		for i in range(p):
			count = 0
			for j in range(n):
				if arr[j] & 1 << i:
					count += 1
			if count > int(n / 2):
				X += 1 << i
		xor_sum = 0
		for i in range(n):
			xor_sum += X ^ arr[i]
		print(xor_sum)
	t = int(input())
	for _ in range(t):
		ab = list(map(int, input().rstrip().split(' ')))
		n = len(ab)
		(a, b) = (ab[0], ab[1])
		findXorSum(ab, n)
except:
	pass


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	(A, B) = getInts()
	if A < B:
		(A, B) = (B, A)
	x = bin(A)[2:]
	y = bin(B)[2:]
	while len(y) < len(x):
		y = '0' + y
	s = ''
	for i in range(len(x)):
		if x[i] == y[i]:
			if x[i] == '1':
				s += '1'
			else:
				s += '0'
		else:
			s += '0'
	z = int(s, 2)
	return (A ^ z) + (B ^ z)
for _ in range(getInt()):
	print(solve())


T = int(input())
for t in range(T):
	st = input().split()
	a = int(st[0])
	b = int(st[1])
	print(a ^ b)


from collections import Counter
import math
import sys
from bisect import bisect, bisect_left, bisect_right
from itertools import permutations

def input():
	return sys.stdin.readline().strip()

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def mod():
	return 10 ** 9 + 7

def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for i in range(INT()):
	(a, b) = MAP()
	x = findX(a, b)
	print((a ^ x) + (b ^ x))


import math
import sys
if __debug__ == False:
	sys.stdin = open('ip.txt', 'r')
	sys.stdout = open('op.txt', 'w')
try:

	def main():
		t = 1
		t = int(sys.stdin.readline())
		while t:
			(a, b) = [int(x) for x in sys.stdin.readline().split()]
			sys.stdout.write(str(a ^ b) + '\n')
			t -= 1
	main()
except Exception as e:
	sys.stdout.write('ErrOR : ' + str(e))


t = int(input())
for i in range(t):
	(a1, b1) = map(int, input().split())
	(a2, b2) = (bin(a1), bin(b1))
	(a, b) = (a2[2:], b2[2:])
	mn = min(len(a), len(b))
	mx = max(len(a), len(b))
	if len(a) < len(b):
		(a, b) = (b, a)
	i = 1
	while i <= mn:
		if a[-i] == '1' and b[-i] == '1':
			if i == 1:
				a = a[:-i] + '0'
				b = b[:-i] + '0'
			else:
				a = a[:-i] + '0' + a[-(i - 1):]
				b = b[:-i] + '0' + b[-(i - 1):]
		i += 1
	x = int(a, 2) + int(b, 2)
	print(x)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))


t = int(input())
s = []
for i in range(t):
	(a, b) = map(int, input().split())
	x = a ^ b
	s.append(int(x))
for i in s:
	print(i)


l = []
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(b, a) = (a, b)
	a1 = bin(a)[2:]
	b1 = bin(b)[2:]
	a1 = a1[::-1]
	b1 = b1[::-1]
	sum = 0
	s = 1
	for i in range(len(a1)):
		if a1[i] == b1[i] == '1':
			sum = sum + s
			s = s * 2
		else:
			s = s * 2
	l.append((a ^ sum) + (b ^ sum))
for i in l:
	print(i)


cases = int(input())
for _ in range(cases):
	(a, b) = list(map(int, input().split()))
	(za, zb) = (a, b)
	x = 0
	h = 1
	while za > 0 or zb > 0:
		if za & 1 == zb & 1:
			x |= (za & 1) * h
		za >>= 1
		zb >>= 1
		h <<= 1
	print((a ^ x) + (b ^ x))


t = int(input())
list1 = []
for i in range(t):
	(a, b) = map(int, input().split())
	list1.append(a ^ b)
for i in list1:
	print(i)


t = int(input())
while t:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	print(a ^ b)


t = int(input())
for _ in range(t):
	a = [0 for i in range(64)]
	ans = 0
	(x, y) = map(int, input().split())
	for i in range(64):
		if x >> i & 1:
			a[i] += 1
		if y >> i & 1:
			a[i] += 1
	for i in range(64):
		if a[i] & 1:
			ans += pow(2, i)
	print(ans)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		(a, b) = ria()
		print(a ^ 0 + b ^ 0)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


for _ in range(int(input())):
	print(eval('^'.join(input().split(' '))))


for i in range(int(input())):
	(n, m) = map(int, input().split())
	if n == m:
		print(0)
	else:
		print(n ^ m)


t = int(input())
for turn in range(t):
	(a, b) = list(map(int, input().rstrip().split()))
	c = min(a, b)
	d = max(a, b)
	(c1, d1) = ('', '')
	while c > 1:
		cmod = c % 2
		dmod = d % 2
		if cmod == 1 and dmod == 1:
			c1 = '0' + c1
			d1 = '0' + d1
		else:
			c1 = str(cmod) + c1
			d1 = str(dmod) + d1
		c = c // 2
		d = d // 2
	cmod = c % 2
	dmod = d % 2
	if cmod == 1 and dmod == 1:
		c1 = '0' + c1
		d1 = '0' + d1
	else:
		c1 = str(cmod) + c1
		d1 = str(dmod) + d1
	c = c // 2
	d = d // 2
	while d > 1:
		d1 = str(d % 2) + d1
		d = d // 2
	if d == 1:
		d1 = '1' + d1
	print(int(c1, 2) + int(d1, 2))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	st = 1
	ma = max(a, b)
	ans = 0
	while st <= ma:
		if st & a == st & b:
			ans += 0
		else:
			ans += st
		st <<= 1
	print(ans)


t = int(input())
for T in range(t):
	(a, b) = [int(x) for x in input().split()]
	print(a ^ b)


for i in range(0, int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	print(a ^ b)


for _ in range(0, int(input())):
	(a, b) = map(int, input().split())
	m = a ^ b
	print(m)


nt = int(input())
for i in range(nt):
	st = input().split(' ')
	a = int(st[0])
	b = int(st[1])
	print(a ^ b)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	ans = a ^ b
	print(ans)


def solve():
	(a, b) = map(int, input().split())
	res = 0
	for i in range(60):
		v = (a >> i & 1) + (b >> i & 1)
		if v == 1:
			res += 1 << i
	print(res)
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	arr = [(a ^ a) + (b ^ a), (a ^ b) + (b ^ b)]
	print(min(arr))


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from itertools import accumulate

def Int():
	return int(sys.stdin.readline())

def Mint():
	return map(int, sys.stdin.readline().split())

def Lstr():
	return list(sys.stdin.readline().strip())

def Str():
	return sys.stdin.readline().strip()

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

def List():
	return list(map(int, sys.stdin.readline().split()))

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def Lcm(x, y):
	return x * y // gcd(x, y)

def dtob(n):
	return bin(n).replace('0b', '')

def btod(n):
	return int(n, 2)

def common(l1, l2):
	return set(l1).intersection(l2)

def solution():
	for i in range(Int()):
		(a, b) = Mint()
		print(a ^ b)
solution()


def proA(arr):
	(x, y) = arr
	return x ^ y
t = int(input())
for i in range(t):
	arr = list(map(int, input().split()))
	print(proA(arr))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	m = min(len(bin(a)), len(bin(b)))
	print(a ^ b)


import math
test = int(input())
for t in range(test):
	(a, b) = map(int, input().split())
	d = a | b
	print((a ^ d) + (b ^ d))


n = int(input())
for i in range(n):
	(n1, n2) = map(int, input().split())
	print(int(n1 ^ n2))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = b ^ a
	d = a ^ b
	print(min(c, d))


def solve():
	(a, b) = [int(v) for v in input().split()]
	print(a ^ b)
t = int(input())
for _ in range(t):
	solve()


for i in range(int(input())):
	(a, b) = map(int, input().split())
	z = a & b
	print((a ^ z) + (b ^ z))


def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split(' ')))
t = read_int()
for case_num in range(t):
	(a, b) = read_ints()
	print(a ^ b)


import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools
import io
import os
input = sys.stdin.readline
import random
sys.setrecursionlimit(10 ** 7)
mo = 10 ** 9 + 7

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
for _ in range(inin()):
	(a, b) = cin()
	k = a & b
	print((a ^ k) + (b ^ k))


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	(n, m) = list(map(int, input().split()))
	print(n ^ m)


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	print(n ^ k)


from collections import Counter
from collections import OrderedDict
from collections import defaultdict

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import math
import sys
import itertools
import fractions
wtf = sys.stdin.read()
wtf = wtf.strip().split('\n')
for t in wtf[1:]:
	(a, b) = map(int, t.split())
	c = min(a, b)
	print((a ^ c) + (b ^ c))


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(a, b) = inputnums()
	print(a ^ b)


t = int(input())
for _ in range(t):
	(p, q) = map(int, input().split())
	a = bin(p)[2:][::-1]
	b = bin(q)[2:][::-1]
	if len(a) > len(b):
		(a, b) = (b, a)
	ans = ''
	for i in range(len(b)):
		if i < len(a):
			if a[i] == b[i]:
				ans += a[i]
			else:
				ans += '0'
		else:
			ans += '0'
	x = int(ans[::-1], 2)
	print((p ^ x) + (q ^ x))


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(max(a, b) ^ min(a, b))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	p = n & k
	a = (n ^ p) + (k ^ p)
	print(a)


from sys import *
import math
input = stdin.readline
I = int
R = range
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())
sJoin = lambda a, sep: '{}'.format(sep).join(a)
arrJoin = lambda a, sep: '{}'.format(sep).join(map(str, a))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	for i in range(5, int(math.sqrt(n) + 1), 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def main():
	for _ in R(I(input())):
		(a, b) = lineInput()
		print(a ^ b)
main()


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import math
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import math
t = int(input())
out = ''
for i in range(t):

	def op(a, b, x):
		return (a ^ x) + (b ^ x)
	(a, b) = map(int, input().split(' '))
	x = a & b
	best = op(a, b, x)
	if i < t - 1:
		out += f'{best}\n'
	else:
		out += f'{best}'
print(out)


import bisect
import collections
import copy
import functools
import heapq
import itertools
import math
import random
import re
import sys
import time
import string
from typing import List
sys.setrecursionlimit(99999)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	for c in range(32):
		ac = a & 1 << c
		bc = b & 1 << c
		if ac != bc:
			ans += 1 << c
	print(ans)


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for i in range(int(input())):
	(a, b) = [int(num) for num in input().split()]
	X = findX(a, b)
	print((a ^ X) + (b ^ X))


t = int(input())
for rezult in range(t):
	(a, b) = map(int, input().split())
	x = a & b
	rezult = (a ^ x) + (b ^ x)
	print(rezult)


answers = []
n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	answers.append(a ^ b)
for i in answers:
	print(i)


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	print(A ^ B)


import sys
input = lambda : sys.stdin.readline().rstrip()
from math import log
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ (a & b) + (b ^ a & b))


from collections import Counter as cnt, defaultdict as dic
iin = lambda : int(input())
lin = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = True

def main():
	(a, b) = lin()
	(a1, b1) = (a, b)
	j = 0
	x = 0
	while a or b:
		if a & 1 and b & 1:
			x += 1 << j
		a >>= 1
		b >>= 1
		j += 1
	print((a1 ^ x) + (b1 ^ x))
if not TEST_CASES:
	main()
else:
	[main() for _ in range(int(input()))]


test_cases = range(int(input()))
for test_case in test_cases:
	(a, b) = list(map(int, input().split()))
	print(a ^ b)


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(a ^ b)


testcases = int(input())
while testcases != 0:
	testcases -= 1
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(a ^ b)


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	(a, b) = ma()
	print(a ^ b)


for s in [*open(0)][1:]:
	(a, b) = map(int, s.split())
	print((a | b) ^ a & b)


from sys import stdin
input = stdin.readline

def A():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(a ^ b)

def B():
	t = int(input())
	for _ in range(t):
		print(_)

def C():
	t = int(input())
	for _ in range(t):
		print(_)

def D():
	t = int(input())
	for _ in range(t):
		print(_)
A()


from functools import reduce
import collections
import math
import sys

class Read:

	@staticmethod
	def string():
		return input()

	@staticmethod
	def int():
		return int(input())

	@staticmethod
	def list(delimiter=' '):
		return input().split(delimiter)

	@staticmethod
	def list_int(delimiter=' '):
		return list(map(int, input().split(delimiter)))

def main():
	t = Read.int()
	for _ in range(t):
		(a, b) = Read.list_int()
		print(a ^ b)
main()


t = int(input())
for i in range(t):
	s1 = ''
	s2 = ''
	(a, b) = map(int, input().split())
	while a != 1:
		s1 = str(a % 2) + s1
		a //= 2
	s1 = '1' + s1
	while b != 1:
		s2 = str(b % 2) + s2
		b //= 2
	s2 = '1' + s2
	if len(s1) < len(s2):
		s1 = (len(s2) - len(s1)) * '0' + s1
	elif len(s1) > len(s2):
		s2 = (len(s1) - len(s2)) * '0' + s2
	cc = ''
	ans = 0
	for j in range(len(s1)):
		if s1[j] != s2[j]:
			ans += 2 ** (len(s1) - 1 - j)
	print(ans)


t = int(input())
for i in range(t):
	ab = list(map(int, input().split()))
	a = ab[0]
	b = ab[1]
	x = a & b
	ans = (a ^ x) + (b ^ x)
	print(ans)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))
	t -= 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(sa, sb) = (bin(a)[2:], bin(b)[2:])
	if len(sa) < len(sb):
		sa = '0' * (len(sb) - len(sa)) + sa
	else:
		sb = '0' * (len(sa) - len(sb)) + sb
	k = ' '
	for i in range(len(sa)):
		if sa[i] == sb[i]:
			if sa[i] == '0':
				k = k + '0'
			else:
				k = k + '1'
		else:
			k = k + '0'
	k = int(k, 2)
	print((a ^ k) + (b ^ k))


def solve():
	(a, b) = map(int, input().split())
	binaryA = '{0:b}'.format(a)
	binaryB = '{0:b}'.format(b)
	la = len(binaryA)
	lb = len(binaryB)
	if la > lb:
		diff = la - lb
		for _ in range(diff):
			binaryB = '0' + binaryB
	elif lb > la:
		diff = lb - la
		for _ in range(diff):
			binaryA = '0' + binaryA
	la = len(binaryA)
	bs = ''
	for i in range(la):
		if binaryA[i] == binaryB[i]:
			bs += binaryA[i]
		else:
			bs += '0'
	r1 = Xor(binaryA, bs)
	r2 = Xor(binaryB, bs)
	i1 = int(r1, 2)
	i2 = int(r2, 2)
	return i1 + i2

def Xor(bsa, bsb):
	l = len(bsa)
	r = ''
	for i in range(l):
		if bsa[i] == bsb[i]:
			r += '0'
		else:
			r += '1'
	return r

def main():
	t = int(input())
	results = []
	for _ in range(t):
		results.append(solve())
	for result in results:
		print(result)
main()


m2 = []
start = 1
for i in range(50):
	m2.append(start)
	start = start * 2

def to_int(ss):
	m = 0
	num = 0
	for s in ss[::-1]:
		num = num + int(s) * m2[m]
		m += 1
	return num
t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	c = str(bin(a ^ b))[2:]
	print(to_int(c))


t = int(input())
for i in range(t):
	(n, m) = input().strip().split(' ')
	(n, m) = [int(n), int(m)]
	k = bin(n)[2:]
	k1 = bin(m)[2:]
	if len(k) < len(k1):
		for j in range(len(k1) - len(k)):
			k = '0' + k
	else:
		for j in range(len(k) - len(k1)):
			k1 = '0' + k1
	ans1 = ''
	ans2 = ''
	for j in range(len(k)):
		if k[j] == k1[j]:
			ans1 += '0'
			ans2 += '0'
		else:
			ans1 += k[j]
			ans2 += k1[j]
	print(int(ans1, 2) + int(ans2, 2))


t = int(input())
sol = []
for i in range(0, t):
	aux = input()
	vari = aux.split(' ')
	vari = list(map(int, vari))
	a = vari[0]
	b = vari[1]
	x = min(a, b)
	xop = a ^ x
	xap = b ^ x
	sum = xop + xap
	sol.append(sum)
for j in sol:
	print(j)


def sol(_):
	(a1, b1) = map(int, input().split())
	a = bin(a1)[2:]
	b = bin(b1)[2:]
	l = min(len(a), len(b))
	new = [0] * l
	for i in range(-1, -len(new) - 1, -1):
		new[i] = int(a[i]) if a[i] == b[i] else 0
	sm = 0
	new = new[::-1]
	for (i, n) in enumerate(new):
		sm += 2 ** i * n
	print((a1 ^ sm) + (b1 ^ sm))
t = int(input())
for i in range(1, t + 1):
	sol(i)


t = input()
t = int(t)
while t:
	(x, y) = input().split()
	x = int(x)
	y = int(y)
	print(x ^ y)
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(a + b - 2 * (a & b))


import sys
input = sys.stdin.readline

def main():
	(a, b) = map(int, input().split())
	print(a ^ b)
for _ in range(int(input())):
	main()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	(a, b) = inp()
	ans = a ^ b
	ans = ans
	out(ans)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10 ** 6)
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def valid(row, col, rows, cols, rcross, lcross):
	return rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)

def main():
	ans = ''
	for _ in range(ii()):
		(a, b) = mi()
		ans += str((a ^ max(a, b)) + (b ^ max(a, b))) + '\n'
	print(ans)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = bin(a)[::-1][:-2]
	b = bin(b)[::-1][:-2]
	l = max(len(a), len(b))
	a = (a + '0' * l)[:l]
	b = (b + '0' * l)[:l]
	s = ''
	for i in range(l):
		if a[i] == b[i]:
			s += '0'
		else:
			s += '1'
	print(int(s[::-1], 2))


def solve():
	(a, b) = map(int, input().split())
	c = a ^ b
	print(c)
t = int(input())
while t > 0:
	solve()
	t -= 1


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


import io
import os
import sys
import math
import heapq
input = sys.stdin.readline
mod = 10 ** 9 + 7
n = int(input())
for _ in range(n):
	(a, b) = list(map(int, input().split()))
	print(a ^ b)


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		(a, b) = mi()
		f = [0] * 31
		for i in range(31):
			if a & 1 << i:
				f[i] += 1
			if b & 1 << i:
				f[i] += 1
		x = 0
		for i in range(31):
			if f[i] == 2:
				x |= 1 << i
		print((a ^ x) + (b ^ x))
if file:
	if path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


def ans(a, b):
	if a < b:
		return ans(b, a)
	a = bin(a)[2:]
	b = bin(b)[2:]
	while len(b) != len(a):
		b = '0' + b
	ret = []
	for i in range(len(a)):
		if a[i] == b[i]:
			ret += '0'
		else:
			ret += '1'
	return int(''.join(ret), 2)
for _ in range(int(input())):
	(a, b) = input().split()
	print(ans(int(a), int(b)))


def main():
	(a, b) = list(map(int, input().split()))
	print(a + b - 2 * (a & b))

def __starting_point():
	t = int(input())
	for i in range(t):
		main()
__starting_point()


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x

def main():
	for _ in range(ii()):
		(a, b) = mi()
		x = findX(a, b)
		print((a ^ x) + (b ^ x))
main()


def get_min(a, b):
	return a ^ b
for t in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	print(get_min(a, b))


def mySolver(a, b):
	print(b ^ a)

def main():
	case = int(input())
	for i in range(0, case):
		li = list(map(int, input().split()))
		mySolver(li[0], li[1])
main()


for i in range(int(input())):
	(x, y) = map(int, input().split())
	j = x & y
	x ^= j
	y ^= j
	print(x + y)


t = int(input())
while t:
	(a, b) = list(map(int, input().split()))
	a = bin(a)[2:]
	b = bin(b)[2:]
	if len(a) < len(b):
		(a, b) = (b, a)
	while len(b) < len(a):
		b = '0' + b
	x = 0
	for i in range(len(a)):
		x = x * 2 + (a[i] == '1' and b[i] == '1')
	print((int(a, 2) ^ x) + (int(b, 2) ^ x))
	t -= 1


for i in range(int(input())):
	(a, b) = map(int, input().split())
	val = a | b
	print((a ^ val) + (b ^ val))


powersof2 = []
for i in range(31):
	powersof2.append(2 ** i)
t = int(input())
for x in range(t):
	c = input().split()
	a = int(c[0])
	b = int(c[1])
	abinary = []
	bbinary = []
	for i in range(31):
		if powersof2[i] > a:
			apower = i - 1
			break
	for i in range(31):
		if powersof2[i] > b:
			bpower = i - 1
			break
	for i in range(apower, -1, -1):
		if a - powersof2[i] >= 0:
			abinary.append(1)
			a -= powersof2[i]
		else:
			abinary.append(0)
	for i in range(bpower, -1, -1):
		if b - powersof2[i] >= 0:
			bbinary.append(1)
			b -= powersof2[i]
		else:
			bbinary.append(0)
	if abinary == bbinary:
		d = 0
	elif abinary != bbinary:
		if len(abinary) < len(bbinary):
			c = len(bbinary) - len(abinary)
			for i in range(c):
				abinary.insert(0, 0)
		elif len(bbinary) < len(abinary):
			c = len(abinary) - len(bbinary)
			for i in range(c):
				bbinary.insert(0, 0)
		for i in range(len(bbinary)):
			if bbinary[i] == abinary[i] and bbinary[i] == 1:
				bbinary[i] = 0
				abinary[i] = 0
		b = 0
		a = 0
		for i in range(len(bbinary)):
			if bbinary[i] == 1:
				c = len(bbinary) - i - 1
				b += 2 ** c
			elif abinary[i] == 1:
				c = len(abinary) - i - 1
				a += 2 ** c
		d = a + b
	print(d)


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	(a, b) = li()
	print(a ^ b)
for _ in range(I()):
	solve()


rn = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rns = lambda : map(int, input().split())
rs = lambda : input()
yn = lambda x: print('Yes') if x else print('No')
YN = lambda x: print('YES') if x else print('NO')
for _ in range(rn()):
	(a, b) = rns()
	print(a ^ b)


import math

def div(n):
	i = 1
	m = []
	while i <= math.sqrt(n):
		if n % i == 0:
			if n / i == i:
				m.append(i)
				return m
			else:
				m.append(i)
				m.append(int(n / i))
				return m
		i = i + 1
for _ in range(0, int(input())):
	o = []
	(a, b) = list(map(int, input().split()))
	num = max(a, b)
	k = div(num)
	if len(k) > 1:
		for i in k:
			ans = (a ^ i) + (b ^ i)
			o.append(ans)
		print(min(o))
	elif len(k) == 1 and k[0] == 1:
		print(0)


import math
from decimal import *
import random
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	for i in range(31, -1, -1):
		if a >> i & 1 and b >> i & 1:
			ans += 2 ** i
	print((a ^ ans) + (b ^ ans))


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		(a, b) = map(int, input().split())
		(x, y) = (bin(a)[2:].rjust(32, '0'), bin(b)[2:].rjust(32, '0'))
		ans = 0
		for i in range(32):
			if x[i] == y[i] and x[i] == '1':
				ans += 2 ** (31 - i)
		print((a ^ ans) + (b ^ ans))
main()


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	(a, b) = map(int, stdin.readline().split())
	print(a ^ b)


import math
import sys
import collections
import bisect
input = sys.stdin.readline
flush = sys.stdout.flush
readint = lambda : int(input())
readintm = lambda : map(int, input().strip().split())
readintl = lambda : list(map(int, input().strip().split()))
readfloatm = lambda : map(float, input().strip().split())
readfloatl = lambda : list(map(float, input().strip().split()))
readstr = lambda : input().strip()
readstrl = lambda : list(input().strip())
join = lambda x, l: x.join(map(str, l))
print = lambda *x: sys.stdout.write(' '.join(map(str, x)) + '\n')
printl = lambda l: sys.stdout.write(' '.join(map(str, l)) + '\n')
ceil = lambda x, y: (x + y - 1) // y
mod = 1000000007
for _ in range(readint()):
	(a, b) = readintm()
	print(a ^ b)


for i in range(int(input())):
	values = input()
	(a, b) = (int(values.split()[0]), int(values.split()[1]))
	print(a ^ b)


def binary(n):
	return bin(n).replace('0b', '')

def decimal(x):
	value = 0
	for i in range(len(x)):
		temp = x.pop()
		if temp == '1':
			value += pow(2, i)
	return value
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	a = list(binary(a))
	b = list(binary(b))
	for i in range(1, 1 + min(len(a), len(b))):
		if a[-i] == b[-i] and a[-i] == '1':
			a[-i] = '0'
			b[-i] = '0'
	print(decimal(a) + decimal(b))


t = int(input())
for k in range(t):
	s = list(map(int, input().split(' ')))
	a = s[0]
	b = s[1]
	print(a ^ b)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		(a, b) = inar()
		print(min((a ^ a) + (b ^ a), (a ^ b) + (b ^ b)))
main()


from math import *
a = int(input())
k = 0
c = 0
j = 0
for i in range(a):
	b = input().split(' ')
	c = int(b[0])
	j = int(b[1])
	t = min(c, j)
	k = (c ^ t) + (j ^ t)
	print(k)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	print(x ^ y)


t = int(input())
for caseNr in range(1, t + 1):
	(a, b) = list(map(int, input().split()))
	print(a ^ b)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = a or b
	print((a ^ x) + (b ^ x))


from sys import stdin

def main(a, b):
	minval = min(a, b)
	maxval = max(a, b)
	print(maxval ^ minval)
t = int(stdin.readline())
cases = [[int(s) for s in stdin.readline().split()] for _ in range(t)]
for (a, b) in cases:
	main(a, b)


t = int(input())
test_cases = [[int(i) for i in input().split()] for i in range(t)]
for case in test_cases:
	(astr, bstr) = [str(bin(i))[2:] for i in case]
	leading_zeroes = abs(len(astr) - len(bstr))
	if len(astr) <= len(bstr):
		astr = '0' * leading_zeroes + astr
	else:
		bstr = '0' * leading_zeroes + bstr
	xstr = ''
	for (ai, bi) in zip(*[list(j) for j in (astr, bstr)]):
		xstr += str(ai if ai == bi else 0)
	(aint, bint, xint) = [int(i, 2) for i in (astr, bstr, xstr)]
	answer = (aint ^ xint) + (bint ^ xint)
	print(answer)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = max(a, b)
	ans = (a ^ x) + (b ^ x)
	print(ans)


cases = int(input())
for i in range(cases):
	(a, b) = map(int, input().split(' '))
	print((a ^ a & b) + (b ^ a & b))


import math

def solve():
	(a, b) = map(int, input().split())
	print(a ^ b)
for z in range(int(input())):
	solve()


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	sa = bin(a)[2:]
	sb = bin(b)[2:]
	sa = sa[::-1]
	sb = sb[::-1]
	bina = sa
	binb = sb
	m = max(len(bina), len(binb))
	bina = bina + '0' * (m - len(bina))
	binb = binb + '0' * (m - len(binb))
	s = 0
	for i in range(m):
		x1 = bina[i]
		x2 = binb[i]
		if x1 != x2:
			s += 2 ** i
	print(s)


t = int(input())
for tt in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from math import ceil, floor, log
from collections import Counter, deque
from heapq import heappush, heappop, heapify
from itertools import permutations, product

def cin():
	return stdin.readline().rstrip()

def mapi():
	return map(int, input().split())

def veci():
	return list(map(int, input().split()))
mod = 1000000007

def solve(a, b):
	return a ^ b
for t in range(int(cin())):
	(a, b) = mapi()
	print(solve(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (bin(a)[2:], bin(b)[2:])
	(len_a, len_b) = (len(str(a)), len(str(b)))
	if len_a > len_b:
		b = '0' * (len_a - len_b) + b
		len_b = len_a
	else:
		a = '0' * (len_b - len_a) + a
		len_a = len_b
	wynik = 0
	for x in range(len_a - 1, -1, -1):
		if a[x] != b[x]:
			wynik += 2 ** (len_a - 1 - x)
	print(wynik)


from math import *
import sys
from sys import stdin
from sys import stdout
for __ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


def solve():
	(A, B) = map(int, input().split())
	print(A ^ B)
	return
for _ in range(int(input())):
	solve()


for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print((a ^ max(a, b)) + (b ^ max(a, b)))


def xor_wise(a, b):
	(_a, _b) = (a, b)
	res = count = 0
	while a or b:
		if a & 1 + b & 1 == 2:
			res += 1 << count
		count += 1
		a = a >> 1
		b = b >> 1
	return res ^ _a + res ^ _b
tcs = int(input())
while tcs:
	(a, b) = input().split(' ')
	print(xor_wise(int(a), int(b)))
	tcs -= 1


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	(a, b) = sep()
	print(a ^ b)
testcase(int(inp()))


read = lambda : map(int, input().split())
t = int(input())
for i in range(t):
	(a, b) = read()
	print(a ^ b)


from math import log2

def findX(arr, n):
	itr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itr:
			itr = arr[i]
	p = int(log2(itr)) + 1
	X = 0
	for i in range(p):
		counter = 0
		for j in range(n):
			if arr[j] & 1 << i:
				counter += 1
		if counter > int(n / 2):
			X += 1 << i
	sum = 0
	for i in range(n):
		sum += X ^ arr[i]
	print(sum)
A = []
test = int(input())
for i in range(test):
	A = list(map(int, input().strip().split()))
	findX(A, 2)
	A = []


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	aORb = a | b
	a_ORb_ = ~a | ~b
	if a_ORb_ == -1:
		print(aORb)
	else:
		print(aORb & a_ORb_)


t = int(input())
while t:
	t -= 1
	(u, v) = list(map(int, input().split()))
	a = u
	b = v
	s = ''
	while a and b:
		x = a % 2
		y = b % 2
		if x == 1 and y == 1:
			s = '1' + s
		else:
			s = '0' + s
		a = a // 2
		b = b // 2
	num = int(s, 2)
	print((u ^ num) + (v ^ num))


t = int(input())
for case in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


import statistics
import math
import datetime
import collections
import array
n = int(input())
for i in range(0, n):
	(x, y) = map(int, input().split())
	print(x ^ y)


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	(a, b) = tuple((int(x) for x in stdin.readline().split()))
	(aa, bb) = (a, b)
	ans = 0
	multiplier = 1
	while a and b:
		if a % 2 == 1 and b % 2 == 1:
			ans += multiplier
		multiplier *= 2
		a //= 2
		b //= 2
	print((aa ^ ans) + (bb ^ ans))


t = int(input())
while t:
	n = input()
	(a, b) = [int(x) for x in n.split()]
	x = min(a, b)
	ans = (a ^ x) + (b ^ x)
	print(ans)
	t -= 1


T = int(input())
for _ in range(T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	temp = a & b
	ans = (a ^ temp) + (b ^ temp)
	print(ans)


for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	print(min(y ^ x, x ^ y))


t = int(input())
for p in range(t):
	(x, y) = map(int, input().split())
	if x > y:
		pom = x
		x = y
		y = pom
	x = bin(x)[2:][::-1]
	y = bin(y)[2:][::-1]
	xx = ''
	yy = ''
	for i in range(len(x)):
		if x[i] == '1' and y[i] == '1':
			xx += '0'
			yy += '0'
		else:
			xx += x[i]
			yy += y[i]
	for i in range(len(x), len(y)):
		yy += y[i]
	ans = 0
	for i in range(len(xx)):
		if xx[i] == '1':
			ans += 2 ** i
	for i in range(len(yy)):
		if yy[i] == '1':
			ans += 2 ** i
	print(ans)


t = int(input())
for T in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


from collections import deque
from collections import OrderedDict
from queue import PriorityQueue
import math
import sys
import os
import threading
import bisect
import operator
import queue
import heapq
from atexit import register
from io import BytesIO
import io
from sys import stdin, stdout
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def bitRep(v):
	ar = []
	while v > 0:
		ar.append(v % 2)
		v //= 2
	return ar
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	bitA = bitRep(a)
	bitB = bitRep(b)
	while len(bitA) != len(bitB):
		if len(bitA) < len(bitB):
			bitA.append(0)
		else:
			bitB.append(0)
	answer = 0
	for i in range(len(bitB)):
		if bitA[i] != bitB[i]:
			answer += 2 ** i
	print(answer)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	c = list(bin(a)[2:])
	d = list(bin(b)[2:])
	(l1, l2) = (len(c), len(d))
	if l1 < l2:
		c = ['0'] * (l2 - l1) + c
	if l2 < l1:
		d = ['0'] * (l1 - l2) + d
	m = [0] * max(l1, l2)
	for x in range(max(l1, l2)):
		if c[x] == d[x]:
			m[x] = 1 ^ int(c[x])
	for x in range(max(l1, l2)):
		m[x] = str(m[x])
	print(int(''.join(m), 2) ^ a + int(''.join(m), 2) ^ b)
	t -= 1


def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(a, b) = mi()
	print(a ^ b)


def solve(a, b):
	num = max(a, b)
	x = 0
	for i in range(0, 33):
		if num & 1 << i >= 1:
			x |= 1 << i
	return (a ^ x) + (b ^ x)

def main(input_path=0):
	with open(input_path) as f:
		t = int(f.readline())
		for _ in range(t):
			(x, y) = [int(x) for x in f.readline().strip().split(' ')]
			print(solve(x, y))
main()


for T in range(int(input())):
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	(a, b) = (L[0], L[1])
	print(a ^ b)


n = int(input())
while n:
	(a, b) = map(int, input().split())
	print(a ^ b)
	n -= 1


t = int(input())
l = []
for i in range(t):
	sm = 10000000
	a = [int(i) for i in input().split()]
	x = a[0] & a[1]
	sm = (a[0] ^ x) + (a[1] ^ x)
	l.append(sm)
for i in l:
	print(i)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))

def xorwice():
	t = inp()
	for i in range(0, t):
		pair = invr()
		print(pair[0] ^ pair[1])
		print('\n')

def main():
	xorwice()
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (bin(a)[2:][::-1], bin(b)[2:][::-1])
	i = 0
	k = min(len(a), len(b))
	out = 0
	while i < k:
		if a[i] != b[i]:
			out += 1 << i
		i += 1
	if len(a) > k:
		while i < len(a):
			if a[i] == '1':
				out += 1 << i
			i += 1
	elif len(b) > k:
		while i < len(b):
			if b[i] == '1':
				out += 1 << i
			i += 1
	print(out)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(str(a ^ b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(max(a, b) ^ min(a, b))


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		print(a ^ b)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	m = 0
	for i in range(30):
		mask = 1 << i
		if a & mask > 0 and b & mask > 0:
			m |= mask
	ans = (a ^ m) + (b ^ m)
	print(ans)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	y = a and b
	s1 = (a ^ y) + (b ^ y)
	print(s1)


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)
for _ in range(vary(1)):
	(a, b) = vary(2)
	z = max(a, b)
	print((a ^ z) + (b ^ z))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	(a, b) = map(int, input().split())
	(b1, b2) = (binary(a, 69)[::-1], binary(b, 69)[::-1])
	x = 0
	for i in range(69):
		x += 2 ** i if b1[i] == b2[i] == '1' else 0
	print((a ^ x) + (b ^ x))


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return input()

def inp():
	return int(sinp())

def minp():
	return map(int, sinp().split())

def linp():
	return list(minp())

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	(a, b) = minp()
	a = bin(a)[2:]
	b = bin(b)[2:]
	(i, j) = (len(a) - 1, len(b) - 1)
	res = ''
	while i and j:
		if a[i] == b[j]:
			res += a[i]
		else:
			res += '0'
		i -= 1
		j -= 1
	res += '1'
	res = int(res[::-1], 2)
	pr((int(a, 2) ^ res) + (int(b, 2) ^ res))


import sys

def func(x):
	return bin(int(x))[2:len(bin(int(x)))]
for i in range(0, int(sys.stdin.readline())):
	l = list(map(int, sys.stdin.readline().split()))
	a = bin(max(l))[2:len(bin(max(l)))]
	b = bin(min(l))[2:len(bin(min(l)))]
	a = a[::-1]
	b = b[::-1]
	c = 0
	for j in range(0, len(a)):
		try:
			q = b[j]
		except:
			q = '0'
		if a[j] != q:
			c += 2 ** j
	sys.stdout.write(str(c) + '\n')


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	(a, b) = MI()
	print(a ^ b)


def solve(a, b):
	return a ^ b
noOfTestCases = int(input())
for i in range(noOfTestCases):
	(x1, y1) = map(int, input().split())
	ans = solve(x1, y1)
	print(ans)


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	(a, b) = map(int, inputi().split())
	x = a & b
	print((a ^ x) + (b ^ x))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


nn = int(input())
while nn:
	c = 0
	(a, b) = map(int, input().split())
	i = min(a, b)
	c = (a ^ i) + (b ^ i)
	print(c)
	nn -= 1


test_num = int(input())
while test_num:
	(a, b) = map(int, input().split())
	print(a ^ b)
	test_num = test_num - 1


import sys
import math
from math import *
from collections import Counter, defaultdict, deque
from bisect import bisect_left
import random
lip = lambda : list(map(int, input().split()))
ip = lambda : int(input())
sip = lambda : input().split()
mod = 10 ** 9 + 7

def main():
	(a, b) = lip()
	print(a ^ b)
for i in range(ip()):
	main()


t = int(input())
i = 0
while i < t:
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))
	i += 1


test = int(input())
for t in range(test):
	(a, b) = map(int, input().split())
	print(a ^ b)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	x = bin(max(a, b))
	y = bin(min(a, b))
	y = y.replace('0b', '')
	x = x.replace('0b', '')
	y = '0' * (len(x) - len(y)) + y
	z = ''
	ans = 0
	for i in range(len(x)):
		if x[i] != y[i]:
			z += '0'
		elif x[i] == '1':
			z += '1'
			ans += 2 ** (len(x) - i - 1)
		else:
			z += '0'
	z = '0b' + z
	zx = a ^ ans + (b ^ ans)
	print(zx)


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

def geti():
	return map(int, input().strip().split())

def getl():
	return list(map(int, input().strip().split()))

def gets():
	return input()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	for _ in range(geta()):
		(a, b) = geti()
		print(a ^ b)
solve()


from sys import stdin, stdout
ans = []

def main():
	(a, b) = list(map(int, stdin.readline().split()))
	ans.append(str(a ^ b))
for i in range(int(stdin.readline())):
	main()
stdout.write('\n'.join(ans))


for u in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


ans = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	ans.append(b ^ a)
print('\n'.join(map(str, ans)))


from __future__ import division, print_function
import os, sys
import math
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

class my_dictionary(dict):

	def __init__(self):
		self = dict()

	def add(self, key, value):
		self[key] = value

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def sli():
	return list(msi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
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}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def factorial(n):
	return 1 if n == 1 or n == 0 else n * factorial(n - 1)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def binary_search(arr, low, high, x):
	if high >= low:
		mid = (high + low) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binary_search(arr, low, mid - 1, x)
		else:
			return binary_search(arr, mid + 1, high, x)
	else:
		return -1

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def nCr(n, r):
	return fact(n) / (fact(r) * fact(n - r))

def fact(n):
	res = 1
	for i in range(2, n + 1):
		res = res * i
	return res

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(my_list):
	freq = {}
	for item in my_list:
		if item in freq:
			freq[item] += 1
		else:
			freq[item] = 1
	return freq

def pos(a):
	b = [0] * len(a)
	c = sorted(a)
	for i in range(len(a)):
		for j in range(len(a)):
			if c[j] == a[i]:
				b[i] = j
				break
	return b

def smallestDivisor(n):
	if n % 2 == 0:
		return 2
	i = 3
	while i * i <= n:
		if n % i == 0:
			return i
		i += 2
	return n

def commonn(a, b, n):
	c = []
	for i in range(n):
		if a[i] == b[i]:
			c.append('-1')
		else:
			c.append(b[i])
	return c

def find_lcm(num1, num2):
	if num1 > num2:
		num = num1
		den = num2
	else:
		num = num2
		den = num1
	rem = num % den
	while rem != 0:
		num = den
		den = rem
		rem = num % den
	gcd = den
	lcm = int(int(num1 * num2) / int(gcd))
	return lcm

def sumdigit(n):
	n = str(n)
	k = 0
	for i in range(len(n)):
		k += int(n[i])
	return k

def main():
	for _ in range(ii()):
		(a, b) = mi()
		j = gcd(a, b)
		c = (a ^ j) + (b ^ j)
		k = min((a ^ b) + (b ^ b), (a ^ a) + (b ^ a))
		print(min(c, k))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


T = int(input())
for _ in range(0, T):
	(a, b) = map(int, input().split())
	t1 = bin(a)[2:]
	t2 = bin(b)[2:]
	t1 = '0' * (35 - len(t1)) + t1
	t2 = '0' * (35 - len(t2)) + t2
	ans = 0
	for i in range(0, 35):
		if t1[35 - i - 1] != t2[35 - i - 1]:
			ans += 2 ** i
	print(ans)


for _ in [*open(0)][1:]:
	(a, b) = map(int, _.split())
	print(a ^ b)


def process():
	(a, b) = list(map(int, input().split()))
	t = a & b
	print((a ^ t) + (b ^ t))
tests = int(input())
for i in range(tests):
	process()


for i in range(int(input())):
	(x, y) = list(map(int, input().split()))
	x1 = bin(x)
	y1 = bin(y)
	x1 = x1[2:]
	y1 = y1[2:]
	x1 = x1[::-1]
	y1 = y1[::-1]
	x2 = list(x1)
	y2 = list(y1)
	s = ''
	for i in range(min(len(x1), len(y1))):
		if x2[i] == '1' and y2[i] == '1':
			x2[i] = '0'
			y2[i] = '0'
	x1 = x2[::-1]
	y1 = y2[::-1]
	x1 = ''.join(map(str, x1))
	y1 = ''.join(map(str, y1))
	x1 = int(x1, 2)
	y1 = int(y1, 2)
	print(x1 + y1)


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split(' ')]
	print((a | b) - (a & b))


for i1 in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	print(a ^ b)


for i in range(int(input())):
	(n, m) = map(int, input().split())
	c = 0
	d = 0
	while n >= 1 or m >= 1:
		if n < 1:
			y = 0
		else:
			y = n % 2
			n = n // 2
		if m < 1:
			t = 0
		else:
			t = m % 2
			m = m // 2
		if y != t:
			d += 2 ** c
		c += 1
	print(d)


n = int(input())

def finding_x(a, b):
	a1 = a
	b1 = b
	j = 0
	x = 0
	while a != 0 or b != 0:
		if a & 1 and b & 1:
			x += 1 << j
		a >>= 1
		b >>= 1
		j += 1
	ans1 = a1 ^ x
	ans2 = b1 ^ x
	return ans1 + ans2
for i in range(n):
	(a, b) = map(int, input().split())
	print(finding_x(a, b))


def main():
	(a, b) = map(int, input().split())
	temp = 0
	for i in range(32):
		if a >> i & 1 == 1 and b >> i & 1 == 1:
			temp += 1 << i
	print((a ^ temp) + (b ^ temp))
for _ in range(int(input())):
	main()


n = int(input())
for i in range(n):
	l = list(map(int, input().split()))
	print(l[0] ^ l[1])


def main(a, b):
	bina = bin(a)[2:]
	binb = bin(b)[2:]
	mlen = len(bina)
	binx = binb[-mlen:]
	x = int(binx, 2)
	return (a ^ x) + (b ^ x)
for _ in range(int(input())):
	(a, b) = sorted([int(x) for x in input().split()])
	print(main(a, b))


for i in range(0, int(input())):
	(x, y) = map(int, input().split())
	print(x ^ y)


from sys import stdin
for _ in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().split())
	bina = list(bin(a)[2:])
	binb = list(bin(b)[2:])
	build = []
	bina[:] = bina[::-1]
	binb[:] = binb[::-1]
	mins = min(len(bina), len(binb))
	for i in range(mins):
		x = bina[i]
		y = binb[i]
		if x == '1' and y == '1':
			build.append(1)
		else:
			build.append(0)
	ans = 0
	for i in range(len(build)):
		ans += 2 ** i * build[i]
	ans = (a ^ ans) + (b ^ ans)
	print(ans)


t = int(input())
for _ in range(0, t):
	inputs = [int(num) for num in input().split()]
	a = inputs[0]
	b = inputs[1]
	c = a & b
	print((a ^ c) + (b ^ c))


res = int(input())
for i in range(res):
	l = list(map(int, input().split()))
	sum = l[0] ^ l[1]
	print(sum, end=' ')


for ctr in range(int(input())):
	(a, b) = map(int, input().split())
	k = a & b
	print((a ^ k) + (b ^ k))


from math import log2

def fX(arr, n):
	itr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itr:
			itr = arr[i]
	p = int(log2(itr)) + 1
	X = 0
	for i in range(p):
		count = 0
		for j in range(n):
			if arr[j] & 1 << i:
				count += 1
		if count > int(n / 2):
			X += 1 << i
	sum1 = 0
	for i in range(n):
		sum1 += X ^ arr[i]
	print(sum1)
for t in range(int(input())):
	(n, m) = map(int, input().split())
	A = [n, m]
	fX(A, 2)


test_count = int(input())
tests = []
for _ in range(test_count):
	test = input()
	tests.append(list(map(int, test.split())))
for test in tests:
	(a, b) = test
	bin_a = '{0:b}'.format(a)
	bin_b = '{0:b}'.format(b)
	if len(bin_a) > len(bin_b):
		bigger = bin_a
		smaller = bin_b
		diff = len(bin_a) - len(bin_b)
	else:
		bigger = bin_b
		smaller = bin_a
		diff = len(bin_b) - len(bin_a)
	x = ''
	for i in range(diff):
		if bigger[i] == '0':
			x += '0'
		else:
			x += '1'
	for j in range(len(smaller)):
		p = bigger[j + diff]
		q = smaller[j]
		if p == q:
			if p == '0':
				x += '0'
			else:
				x += '1'
		else:
			x += '1'
	x = int(x, 2)
	print((a ^ x) + (b ^ x))


for _ in range(int(input())):
	(A, B) = map(int, input().split())
	(C, D) = (A, B)
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	v = (C ^ x) + (D ^ x)
	print(v)


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
g = [list(map(int, input().split())) for i in range(t)]
ans = [0] * t
for i in range(t):
	a = g[i][0]
	b = g[i][1]
	for j in range(30):
		if a >> j & 1 or b >> j & 1:
			if not (a >> j & 1 and b >> j & 1):
				ans[i] += pow(2, j)
for i in range(t):
	print(ans[i])


def findx(a, b):
	j = 0
	x = 0
	while a or b:
		if a & 1 and b & 1:
			x = x + (1 << j)
		a = a >> 1
		b = b >> 1
		j = j + 1
	return x
t = int(input())
while t > 0:
	(a, b) = list(map(int, input().split()))
	x = findx(a, b)
	expr = (a ^ x) + (b ^ x)
	print(expr)
	t = t - 1


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')

def XOR(x, y):
	(x, y) = (bin(x)[2:], bin(y)[2:])
	(a, b) = (len(x), len(y))
	n = max(a, b)
	(x, y) = ('0' * (n - a) + x, '0' * (n - b) + y)
	z = ''
	for i in range(n):
		if x[i] == y[i]:
			z += '0'
		else:
			z += '1'
	return int(z, 2)
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(XOR(a, b))


from math import log2

def findX(arr, n):
	itr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itr:
			itr = arr[i]
	p = int(log2(itr)) + 1
	X = 0
	for i in range(p):
		count = 0
		for j in range(n):
			if arr[j] & 1 << i:
				count += 1
		if count > int(n / 2):
			X += 1 << i
	s = 0
	for i in range(n):
		s += X ^ arr[i]
	return s
for _ in range(int(input())):
	arr = list(map(int, input().split()))
	n = len(arr)
	print(findX(arr, n))


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	(a, b) = minput()
	x = a & b
	print((a ^ x) + (b ^ x))


import sys
input = sys.stdin.readline

def solve():
	(x, y) = map(int, input().split())
	val = x & y
	print((x ^ val) + (y ^ val))
for _ in range(int(input())):
	solve()


for t in range(int(input())):
	(a, b) = map(int, input().split())
	bin_a = bin(a)[2:]
	bin_b = bin(b)[2:]
	len_a = len(bin_a)
	len_b = len(bin_b)
	ans = ['0' for j in range(max(len_a, len_b))]
	if len_a < len_b:
		for i in range(1, len_a + 1):
			if bin_a[-i] == bin_b[-i]:
				ans[-i] = bin_a[-i]
		while i <= len_b:
			ans[-i] = bin_b[-i]
			i += 1
	else:
		for i in range(1, len_b + 1):
			if bin_a[-i] == bin_b[-i]:
				ans[-i] = bin_a[-i]
		while i <= len_a:
			ans[-i] = bin_a[-i]
			i += 1
	ans = ''.join(ans)
	ans = int(ans, 2)
	ans = (ans ^ a) + (ans ^ b)
	print(ans)


def solve():
	(a, b) = [int(v) for v in input().split()]
	for i in range(32):
		if 1 << i & a > 0 and 1 << i & b > 0:
			a ^= 1 << i
			b ^= 1 << i
	print(a + b)
t = int(input())
for _ in range(t):
	solve()


import sys, math

def ii():
	return int(input())

def mii():
	return map(int, input().split())

def lmii():
	return list(mii())

def dtob(n):
	return bin(n).replace('0b', '')

def main():
	for _ in range(ii()):
		(n, m) = mii()
		print(n ^ m)
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	a1 = a
	b1 = b
	a = bin(a)[2:]
	b = bin(b)[2:]
	n = len(a) - len(b)
	if n > 0:
		s = ''
		for i in range(n):
			s += '0'
		b = s + b
	elif n < 0:
		s = ''
		for i in range(-n):
			s += '0'
		a = s + a
	else:
		pass
	ans = 0
	for i in range(len(a)):
		z = 2 ** (len(a) - 1 - i)
		if a[i] == b[i]:
			ans += z * int(a[i])
		else:
			ans += 0
	print((a1 ^ ans) + (b1 ^ ans))


t = int(input())
while t:
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
	else:
		s = ''
		a1 = bin(a)[2:]
		b1 = bin(b)[2:]
		l1 = len(a1)
		l2 = len(b1)
		m = max(l1, l2)
		while l1 < m:
			a1 = '0' + a1
			l1 += 1
		while l2 < m:
			b1 = '0' + b1
			l2 += 1
		for i in range(m):
			if a1[i] == b1[i]:
				s += a1[i]
			else:
				s += '0'
		s = int(s, 2)
		print((a ^ s) + (b ^ s))
	t -= 1


t = int(input())
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	temp1 = a
	temp2 = b
	f = 0
	c = 0
	while a or b:
		if a & 1 and b & 1:
			c = c + (1 << f)
		a = a >> 1
		b = b >> 1
		f = f + 1
	print((temp1 ^ c) + (temp2 ^ c))


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
t = int(input())
while t > 0:
	t -= 1
	(a, b) = map(int, input().split())
	x = findX(a, b)
	print((a ^ x) + (b ^ x))


def main():
	c_nabor = int(input())
	for _ in range(c_nabor):
		(n, m) = map(int, input().split())
		print(n ^ m)
main()


from sys import *
input = stdin.readline

def decToBin(n):
	a = []
	while n:
		a.append(n % 2)
		n = n // 2
	for i in range(len(a), 64):
		a.append(0)
	return a
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l1 = decToBin(x)
	l2 = decToBin(y)
	sn = 0
	for i in range(64):
		if l1[i] != l2[i]:
			sn += 2 ** i
	stdout.write(str(sn) + '\n')


def yeeter():
	n = int(input())
	x = []
	y = []
	for i in range(n):
		ye = input().split()
		x.append(int(ye[0]))
		y.append(int(ye[1]))
	for i in range(n):
		print(x[i] ^ y[i])
yeeter()


import os

def main():
	test_cases = int(input())
	ans = [None] * test_cases
	for t in range(test_cases):
		s = tuple(map(int, input().split()))
		x = s[0] & s[1]
		ans[t] = (s[0] ^ x) + (s[1] ^ x)
	os.write(1, '\n'.join(map(str, ans)).encode())
main()


t = int(input())
x = 0
for j in range(t):
	(a, b) = map(int, input().split())
	ba = bin(a)[2:]
	bb = bin(b)[2:]
	ba = ba[::-1]
	bb = bb[::-1]
	for i in range(min(len(ba), len(bb))):
		if ba[i] == bb[i] and ba[i] == '1':
			x += 2 ** i
	print((a ^ x) + (b ^ x))
	x = 0


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print((a ^ a & b) + (b ^ a & b))


t = int(input())
for _ in range(t):
	(inta, intb) = [int(i) for i in input().split()]
	(a, b) = (bin(inta)[2:], bin(intb)[2:])
	max_len = max(len(a), len(b))
	(a, b) = (a.zfill(max_len), b.zfill(max_len))
	x = []
	for idx in range(max_len):
		(d1, d2) = (a[idx], b[idx])
		if d1 == d2:
			x.append(d1)
		else:
			x.append('1')
	x = int(''.join(x), base=2)
	total = (inta ^ x) + (intb ^ x)
	print(total)


import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7

def resolve():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		x = 0
		for mask in range(30):
			if a & 1 << mask and b & 1 << mask:
				x += 1 << mask
		res = (a ^ x) + (b ^ x)
		print(res)
resolve()


import sys
input = sys.stdin.readline

def bn(a):
	return bin(a)[2:]
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b < a:
		(a, b) = (b, a)
	print(a ^ b)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt, pi, cos, sin, ceil, log2, floor
from bisect import bisect_right, bisect_left, bisect
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)

def sumDigits(no):
	return 0 if no == 0 else int(no % 10) + sumDigits(int(no / 10))
MOD = 1000000007
PMOD = 998244353
N = 10 ** 9 + 7
LOGN = 30
T = 1
T = int(stdin.readline())
for _ in range(T):
	(a, b) = list(map(int, stdin.readline().rstrip().split()))
	x = a & b
	print((a ^ x) + (b ^ x))


t = int(input())
for j in range(t):
	(n, m) = map(int, input().strip().split())
	if n > m:
		print(n ^ m)
	else:
		print(m ^ n)


def main():
	for _ in range(int(input())):
		(a, b) = map(int, input().split())
		n = 1 << 30
		x = ''
		while n:
			if a & n or b & n:
				x += '0'
			else:
				x += '1'
			n >>= 1
		x = '0b' + x
		x = int(x, 2)
		print(a ^ x + b ^ x)
main()


for _ in range(0, int(input())):
	l1 = list(map(int, input().split()))
	a = l1[0]
	b = l1[1]
	print(a ^ b)


t = int(input())
for testCase in range(t):
	(a, b) = [int(e) for e in input().split()]
	print(a ^ b)


from math import *
from cmath import *
from itertools import *
from decimal import *
from fractions import *
from sys import *
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	for i in range(0, 33):
		if a >> i & 1 == 1 and b >> i & 1 == 1:
			ans += 1 << i
	print((a ^ ans) + (b ^ ans))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	j = 0
	c = a
	d = b
	while a > 0 or b > 0:
		if a & 1 and b & 1:
			x += 1 << j
		a >>= 1
		b >>= 1
		j += 1
	print((c ^ x) + (d ^ x))


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	(a, b) = ria()
	wi(a ^ b)


import sys
t = int(input().strip())
for a0 in range(t):
	l1 = [int(i) for i in input().split()]
	l = l1[0]
	r = l1[1]
	print(l ^ r)


import sys
import math
import random
input = sys.stdin.readline
T = int(input())
for t in range(T):
	(a, b) = map(int, input().split())
	print(a ^ b)


from sys import *
from collections import defaultdict as dd
from math import *
from bisect import *

def sinp():
	return input()

def inp():
	return int(sinp())

def minp():
	return map(int, sinp().split())

def linp():
	return list(minp())

def strl():
	return list(sinp())

def pr(x):
	print(x)
mod = int(1000000000.0 + 7)
for _ in range(inp()):
	(a, b) = minp()
	res = a & b
	pr((a ^ res) + (b ^ res))


t = int(input().strip())
for i in range(t):
	(a, b) = map(int, input().strip().split(' '))
	res = 0
	idx = 0
	while a != 0 or b != 0:
		this_bit = a & 1 ^ b & 1
		res = res + pow(2, idx) * this_bit
		idx = idx + 1
		a = a >> 1
		b = b >> 1
	print(res)


from collections import defaultdict
mod = 10 ** 9 + 7
INF = float('inf')

def getlist():
	return list(map(int, input().split()))

def inverse(N, mod):
	return pow(N, mod - 2, mod)

def main():
	T = int(input())
	for _ in range(T):
		(a, b) = getlist()
		ans = a ^ b
		print(ans)
main()


for ii in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


from sys import stdin, stdout
import math
from collections import deque
input = stdin.readline

def print(*args, end='\n'):
	s = []
	for i in args:
		s.append(str(i) + ' ')
	s = ''.join(s)
	stdout.write(s + end)

def solve():
	(a, b) = map(int, input().split())
	print(a ^ b)
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


t = int(input())
i = 1
while i <= t:
	[n, m] = list(map(int, input().split()))
	x = max(n, m)
	print((m ^ x) + (n ^ x))
	i += 1


n = int(input())
lst = []
for i in range(n):
	(a, b) = map(int, input().split())
	lst.append(a ^ b)
for elem in lst:
	print(elem)


from sys import stdin
input = stdin.readline

def solve():
	(a, b) = map(int, input().split())
	print(a ^ b)
t = int(input())
for _ in range(t):
	solve()


for i in ' ' * int(input()):
	(a, b) = map(int, input().split())
	print(a ^ b)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(ta, tb) = (a, b)
	num = 0
	c = 0
	while ta > 0 or tb > 0:
		if ta % 2 == tb % 2:
			num += ta % 2 * pow(2, c)
		ta = ta // 2
		tb = tb // 2
		c += 1
	print((a ^ num) + (b ^ num))


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	(a, b) = inpl()
	ln = len(bin(max(a, b))) - 2
	res = 0
	for i in range(ln):
		if (a >> i) % 2 != (b >> i) % 2:
			res += pow(2, i)
	print(res)


for j in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(a ^ 0 + b ^ 0)


for z in range(int(input())):
	(x, y) = map(int, input().split())
	z = x & y
	print((x ^ z) + (y ^ z))


import sys
MOD = 1000000007

def inp():
	return sys.stdin.readline().strip()

def ii():
	return int(inp())

def iis():
	return [int(i) for i in inp().split()]

def solve():
	(a, b) = iis()
	return a ^ b
t = ii()
for _ in range(t):
	print(solve())


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	(a, b) = (max(a, b), min(a, b))
	aa = bin(a)[2:]
	bb = bin(b)[2:]
	bb = '0' * (len(aa) - len(bb)) + bb
	ans = 0
	for i in range(len(aa)):
		ans *= 2
		if aa[i] == bb[i] == '1':
			pass
		elif aa[i] == '1' or bb[i] == '1':
			ans += 1
	print(ans)


import math as mt
import bisect
import sys
input = sys.stdin.readline
t = int(input())
import collections
import heapq
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	return a ^ b
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve())


import io
import os
import math
cin = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_input():
	return cin().split()

def get_int_input():
	return list(map(int, get_input()))

def C1421A(a, b):
	x = a & b
	return (a ^ x) + (b ^ x)

def main():
	(T,) = get_int_input()
	for _ in range(T):
		(a, b) = get_int_input()
		print(C1421A(a, b))
main()


def testcase():
	(a, b) = map(int, input().split())
	x = a & b
	ans = (a ^ x) + (b ^ x)
	print(ans)
	return
t = int(input())
for _ in range(t):
	testcase()


no_inp = int(input())

def problem_sol(a, b):
	sol = 0
	(bin_a, bin_b) = map(str, [bin(a), bin(b)])
	bin_a = bin_a[2:]
	bin_b = bin_b[2:]
	len_diff = len(bin_a) - len(bin_b)
	if len_diff < 0:
		bin_a = '0' * -len_diff + bin_a
	elif len_diff > 0:
		bin_b = '0' * len_diff + bin_b
	for (i, c) in enumerate(bin_a):
		if bin_a[i] != bin_b[i]:
			sol += 2 ** (len(bin_a) - 1 - i)
	print(sol)
while no_inp > 0:
	(a, b) = map(int, input().split())
	problem_sol(a, b)
	no_inp -= 1


for i in range(int(input())):
	(n, k) = map(int, input().split())
	n = bin(n)[2:]
	k = bin(k)[2:]
	if len(n) < len(k):
		(n, k) = (k, n)
	ans = ''
	k = '0' * (len(n) - len(k)) + k
	for i in range(len(n)):
		if n[i] == '0' or k[i] == '0':
			ans += '0'
		else:
			ans += '1'
	n = int(n, 2)
	k = int(k, 2)
	ans = int(ans, 2)
	print((n ^ ans) + (k ^ ans))


for _ in range(int(input())):
	(a, b) = [int(j) for j in input().split()]
	x = a & b
	t1 = a ^ x
	t2 = b ^ x
	ans = t1 + t2
	print(ans)


for _ in [0] * int(input()):
	(a, b) = map(int, input().split())
	print(a ^ b)


t = int(input())

def bin_int(s):
	s = s[::-1]
	ans = 0
	for i in range(len(s)):
		if s[i] == '1':
			ans = ans + pow(2, i)
	return ans
for i in range(t):
	(a, b) = map(int, input().split())
	t1 = bin(a)
	t2 = bin(b)
	t1 = t1[2:]
	t2 = t2[2:]
	if len(t1) > len(t2):
		k = len(t1) - len(t2)
		t2 = '0' * k + t2
	else:
		k = len(t2) - len(t1)
		t1 = '0' * k + t1
	s = ''
	for j in range(len(t1)):
		if t1[j] != t2[j]:
			s = s + '1'
		else:
			s = s + '0'
	print(bin_int(s))


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	j = 0
	i = 0
	x1 = int(x)
	y1 = int(y)
	while x or y:
		if x & 1 and y & 1:
			i += 1 << j
		x >>= 1
		y >>= 1
		j += 1
	ans = (i ^ x1) + (i ^ y1)
	print(ans)
	t -= 1


from bisect import *
from collections import *
from math import *
from heapq import *
from typing import List
from itertools import *
from operator import *
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

@lru_cache(None)
def fact(x):
	if x < 2:
		return 1
	return fact(x - 1) * x

@lru_cache(None)
def per(i, j):
	return fact(i) // fact(i - j)

@lru_cache(None)
def com(i, j):
	return per(i, j) // fact(j)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d
t = N()
for i in range(t):
	(a, b) = RL()
	ans = a ^ b
	print(ans)


from sys import *
input = stdin.readline
I = int
R = range
listInput = lambda : list(map(int, input().strip().split()))
lineInput = lambda : map(int, input().strip().split())

def main():
	for _ in R(I(input())):
		(a, b) = lineInput()
		print(a ^ b)
main()


for l in [*open(0)][1:]:
	(a, b) = map(int, l.split())
	print(a ^ b)


t = int(input())
w = []
for i in range(t):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	w.append(a ^ b)
for i in w:
	print(i)


for w in range(int(input())):
	(a, b) = map(int, input().split())
	print((a ^ a & b) + (b ^ a & b))


for _ in range(int(input())):
	(n, m) = list(map(int, input().split()))
	print(n ^ m)


T = int(input())
ans_ls = [0] * T
for t in range(T):
	(a, b) = map(int, input().split())
	base = 0
	ans = 0
	while a > 0 or b > 0:
		(a, r1) = divmod(a, 2)
		(b, r2) = divmod(b, 2)
		if r1 != r2:
			ans += 2 ** base
		base += 1
	ans_ls[t] = ans
for ans in ans_ls:
	print(ans)


for tt in range(int(input())):
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	v = min(a, b)
	x = a ^ v
	x += b ^ v
	print(x)


import sys
input = sys.stdin.readline

def solve():
	(n, m) = map(int, input().split())
	print(n ^ m)
for _ in range(int(input())):
	solve()


t = int(input())
for q in range(t):
	(a, b) = map(int, input().split())
	result1 = []
	result2 = []
	ans = []
	while a:
		result1.append(a % 2)
		a //= 2
	result1.reverse()
	while b:
		result2.append(b % 2)
		b //= 2
	result2.reverse()
	if len(result1) < len(result2):
		(result1, result2) = (result2, result1)
	x = len(result1) - len(result2)
	for i in range(len(result2) - 1, -1, -1):
		if (result2[i] + result1[i + x]) % 2 == 0:
			ans.append(0)
		else:
			ans.append(1)
	for j in range(x - 1, -1, -1):
		ans.append(result1[j])
	u = 0
	ans.reverse()
	for k in range(len(ans) - 1, -1, -1):
		u += ans[k] * 2 ** (len(ans) - k - 1)
	print(u)


t = int(input())

def bits(x):
	s = ''
	while x != 0:
		s += str(x % 2)
		x //= 2
	s += '0' * (40 - len(s))
	return s
for _ in range(t):
	(a, b) = map(int, input().split())
	a1 = bits(a)
	b1 = bits(b)
	e = 0
	for i in range(40):
		if a1[i] != b1[i]:
			e += 2 ** i
	print(e)


def solve(a, b):
	x = a & b
	return (x ^ a) + (x ^ b)
tc = int(input())
for _ in range(tc):
	(a, b) = map(int, input().split(' '))
	print(solve(a, b))


def bn(n):
	s = ''
	while n > 0:
		s += str(n % 2)
		n //= 2
	return s
t = int(input())
f = []
for i in range(t):
	(a, b) = map(int, input().split())
	(s1, s2) = (bn(a), bn(b))
	(q, e) = (len(s1), len(s2))
	if q > e:
		while q > e:
			s2 += '0'
			e += 1
	else:
		while q < e:
			s1 += '0'
			q += 1
	step = 1
	ans = 0
	for i in range(len(s1)):
		if s1[i] != s2[i]:
			ans += step
		step *= 2
	f.append(ans)
for i in f:
	print(i)


import sys
from random import *
pl = 1
from copy import *
if pl:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('outpt.txt', 'w')

def li():
	return [int(xxx) for xxx in input().split()]

def fi():
	return int(input())

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())
t = fi()
while t > 0:
	t -= 1
	(a, b) = mi()
	c = 0
	for i in range(35):
		if bool(a & 2 ** i) != bool(b & 2 ** i):
			c += 2 ** i
	print(c)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
inp = lambda : int(input())
strng = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
strl = lambda : list(input().strip())
mul = lambda : map(int, input().strip().split())
mulf = lambda : map(float, input().strip().split())
seq = lambda : list(map(int, input().strip().split()))
ceil = lambda x: int(x) if x == int(x) else int(x) + 1
ceildiv = lambda x, d: x // d if x % d == 0 else x // d + 1
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdarr = lambda : map(int, stdstr().split())
mod = 1000000007
for _ in range(stdint()):
	(a, b) = stdarr()
	print(a ^ b)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	sol = a ^ b
	print(str(sol))
	t = t - 1


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ac = a
	bc = b
	z = 0
	x = 0
	while a or b:
		if a & 1 and b & 1:
			x += 1 << z
		a >>= 1
		b >>= 1
		z += 1
	print((ac ^ x) + (bc ^ x))


for _ in range(int(input())):
	l = list(map(int, input().split()))
	print(l[0] ^ l[1])


def dec(n):
	return bin(n).replace('0b', '')
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	a1 = dec(a)
	b1 = dec(b)
	ans = ''
	c = max(len(a1), len(b1))
	if c == len(a1):
		b1 = (len(a1) - len(b1)) * '0' + b1
	else:
		a1 = (len(b1) - len(a1)) * '0' + a1
	for j in range(c):
		if a1[j] == b1[j]:
			ans += '0'
		else:
			ans += '1'
	print(int(ans, 2))


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(v):
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return adj

def solve():
	(a, b) = IP()
	(ca, cb) = (a, b)
	bb = [0] * 64
	ba = [0] * 64
	i = 63
	while a > 0:
		if a & 1:
			ba[i] = 1
		a = a >> 1
		i -= 1
	i = 63
	while b > 0:
		if b & 1:
			bb[i] = 1
		b = b >> 1
		i -= 1
	s = ''
	for i in range(64):
		if ba[i] == 1 and bb[i] == 1:
			s += '1'
		else:
			s += '0'
	val = int(s, 2)
	print((ca ^ val) + (cb ^ val))
	return
t = II()
for i in range(t):
	solve()


import sys
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def print(x):
	sys.stdout.write(str(x) + '\n')
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


for nt in range(int(input())):
	(a, b) = map(int, input().split())
	x = a & b
	print((a ^ x) + (b ^ x))


k = []
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	k.append(a ^ b)
for i in k:
	print(i)


t = int(input())
for _ in range(t):
	[n1, n2] = [int(p) for p in input().split()]
	s1 = bin(n1)
	s1 = s1[2:]
	s2 = bin(n2)
	s2 = s2[2:]
	l1 = len(s1)
	l2 = len(s2)
	if l2 > l1:
		s1 = '0' * (l2 - l1) + s1
		l = l2
	elif l2 < l1:
		s2 = '0' * (l1 - l2) + s2
		l = l1
	else:
		l = l1
	count = 0
	temp = 0
	for i in range(l):
		if s1[i] != s2[i]:
			count += 2 ** (l - i - 1)
	print(count)


def XOR(a, b):
	return a ^ b
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	print(XOR(a, b))


def XF(a, b):
	x = 0
	j = 0
	while a or b:
		if a & 1 and b & 1:
			x += 1 << j
		a >>= 1
		b >>= 1
		j += 1
	return x
for _ in range(int(input())):
	(A, B) = map(int, input().split())
	x = XF(A, B)
	print((A ^ x) + (B ^ x))


for _ in range(int(input())):
	(s, t) = map(int, input().split())
	print(s ^ t)


import sys

def swap(x, y, a):
	temp = a[x]
	a[x] = a[y]
	a[y] = temp
	return a

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q)):
		print(q[i][0] ^ q[i][1])
main()


n = int(input())
ar = []
for i in range(n):
	sar = [int(x) for x in input().split()]
	ar.append(sar)
ans = []
for i in ar:
	y = i[0] ^ i[1]
	ans.append(y)
for i in ans:
	print(i)


def solve(a, b):
	x = a & b
	return (a ^ x) + (b ^ x)
t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(solve(a, b))
	t -= 1


for test in range(1, int(input()) + 1):
	(a, b) = map(int, input().split())
	print(a ^ b)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	mn = a ^ b
	print(mn)
	t = t - 1


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	x = findX(a, b)
	aX = a ^ x
	bX = b ^ x
	print(aX + bX)


T = int(input())

def res(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for i in range(T):
	(a, b) = tuple(map(int, input().split()))
	x = res(a, b)
	v = (a ^ x) + (b ^ x)
	print(v)


from typing import Counter
import sys
from collections import defaultdict as dd
from math import *

def vinp():
	return map(int, input().split())

def linp():
	return list(map(int, input().split()))

def sinp():
	return input()

def inp():
	return int(input())

def mod(f):
	return f % 1000000007

def pr(*x):
	print(*x)

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def finp():
	f = open('input.txt', 'r')
	f = f.read().split('\n')
	return f

def fout():
	return open('output.txt', 'w')

def fpr(f, x):
	f.write(x + '\n')

def csort(c):
	sorted(c.items(), key=lambda pair: pair[1], reverse=True)

def indc(l, n):
	c = {}
	for i in range(n):
		c[l[i]] = c.get(l[i], []) + [i + 1]
	return c
cou = inp()
for i in range(cou):
	(a, b) = vinp()
	(aaa, bbb) = (a, b)
	a = bin(a)[2:]
	b = bin(b)[2:]
	aa = len(a)
	bb = len(b)
	c = ''
	if aa > bb:
		b = '0' * (aa - bb) + b
	else:
		a = '0' * abs(aa - bb) + a
	for i in range(max(aa, bb)):
		if a[i] == b[i]:
			c += a[i]
		else:
			c += '0'
	c = int(c, 2)
	pr((aaa ^ c) + (bbb ^ c))


t = int(input())
while t:
	t -= 1
	(a, b) = list(map(int, input().strip().split()))
	print(a ^ b)


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	(n, m) = map(int, stdin.readline().split())
	print(n ^ m)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	k = 1
	a1 = a
	b1 = b
	rs = 0
	cnt = [int(0) for i in range(100)]
	kek = 0
	while k <= max(a, b):
		k *= 2
		kek += 1
	k1 = k
	kek1 = kek
	while k1 > 0:
		if a >= k1:
			a -= k1
			cnt[kek1] += 1
		k1 //= 2
		kek1 -= 1
	kek1 = kek
	k1 = k
	while k1 > 0:
		if b >= k1:
			b -= k1
			cnt[kek1] += 1
		k1 //= 2
		kek1 -= 1
	k = 1
	for i in range(100):
		if cnt[i] == 2:
			rs += k
		k *= 2
	print((a1 ^ rs) + (b1 ^ rs))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = bin(a)
	y = bin(b)
	x = x[2:]
	y = y[2:]
	if len(x) < len(y):
		d = len(y) - len(x)
		x = '0' * d + x
	if len(y) < len(x):
		d = len(x) - len(y)
		y = '0' * d + y
	ans = ''
	for i in range(len(x)):
		if x[i] == y[i]:
			ans += x[i]
		else:
			ans += '0'
	new = int('0b' + ans, 2)
	print((a ^ new) + (b ^ new))


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	arr1 = list(bin(a))
	arr2 = list(bin(b))
	arr3 = []
	arr1.remove('b')
	arr2.remove('b')
	arr1.reverse()
	arr2.reverse()
	for (k, kk) in zip(arr1, arr2):
		if k == '1' and kk == '1':
			arr3.append('1')
		else:
			arr3.append('0')
	arr3.reverse()
	z = int(''.join(arr3), 2)
	print((a ^ z) + (b ^ z))


reps = input()

def xor(a, b):
	return '1' if a != b else '0'
for i in range(int(reps)):
	(b1, b2) = input().split(' ')
	b1 = list(bin(int(b1)).replace('0b', ''))
	if len(b1) < 32:
		dif = 32 - len(b1)
		b1 = list(str(0) * dif) + b1
	b2 = list(bin(int(b2)).replace('0b', ''))
	if len(b2) < 32:
		dif2 = 32 - len(b2)
		b2 = list(str(0) * dif2) + b2
	binRep = ''.join(map(xor, b1, b2))
	print(int(binRep, 2))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for _ in range(t):
	(a, b) = I()
	x = a ^ b
	print(x)


import sys
from typing import List
sys.setrecursionlimit(10 ** 9)

def lmi():
	return list(map(int, input().split()))

def main():
	T = int(input())
	for _ in range(T):
		(a, b) = lmi()
		result = solve(a, b)
		print(result)

def solve(a, b) -> int:
	return a ^ b
main()


inp = lambda : int(input())
seq = lambda : list(map(int, input().strip().split()))

def results(rr):
	(a, b) = (rr[0], rr[1])
	(j, x) = (0, 0)
	while a or b:
		if a & 1 and a & 1:
			x += 1 << j
		a >>= 1
		b >>= 1
		j += 1
	return x

def main():
	t = inp()
	for _ in range(t):
		cd = seq()
		(c, d) = (cd[0], cd[1])
		x = results(cd)
		print((c ^ x) + (d ^ x))
main()


def find_min_xor_sum(a, b):
	return a ^ b
n = int(input())
for t in range(n):
	(a, b) = [int(s) for s in input().split(' ')]
	result = find_min_xor_sum(a, b)
	print(result)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	k = min(a, b)
	z = (a ^ k) + (b ^ k)
	print(z)


tc = int(input())
for i in range(tc):
	(a, b) = map(int, input().split())
	print(a ^ b)


test = int(input())
for i in range(test):
	(a, b) = map(int, input().split())
	print(a ^ b)


import sys as _sys

def main():
	t = int(input())
	for i_t in range(t):
		(a, b) = _read_ints()
		result = (a ^ a) + (b ^ a)
		print(result)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split())
main()


for k in range(int(input())):
	ab = list(map(int, input().split()))
	print(int(min(ab[0], ab[1]) ^ max(ab[0], ab[1])))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a == 1 and b == 1:
		print(0)
	else:
		print(a ^ b)


n = int(input())
ab = [list(map(int, input().split())) for _i in range(n)]
for (a, b) in ab:
	x = a & b
	y = a ^ x
	z = b ^ x
	print(y + z)


for i in range(int(input())):
	a = list(map(int, input().split()))
	print(a[0] ^ a[1])


def xor(a, b):
	(i, x) = (0, 0)
	while a or b:
		if a & 1 and b & 1:
			x += 1 << i
		a >>= 1
		b >>= 1
		i += 1
	return x
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = xor(a, b)
	print((a ^ x) + (b ^ x))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):
	print(stack)

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	(a, b) = sep()
	print(a ^ b)
testcase(int(inp()))


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
for _ in range(II()):
	(a, b) = MI()
	ans = 0
	for k in range(32, -1, -1):
		if a >> k & 1 != b >> k & 1:
			ans += 1 << k
	print(ans)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from bisect import bisect_right
import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


n = int(input())
while n:
	(a, b) = [int(x) for x in input().split()]
	print(a ^ b)
	n -= 1


cases = int(input())
for t in range(cases):
	(a, b) = list(map(int, input().split()))
	print(a ^ b)


for s in [*open(0)][1:]:
	(A, B) = map(int, s.split())
	print(A ^ B)


def main(a, b):
	x = a & b
	a = a ^ x
	b = b ^ x
	print(a + b)
n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split(' ')))
	main(a, b)


from sys import stdin, stdout
t = int(input())
while t > 0:
	a = list(map(int, stdin.readline().split()))
	print(a[0] ^ a[1])
	print('\n')
	t -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B):
	x = A & B
	return (A ^ x) + (B ^ x)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(A, B) = [int(x) for x in input().split()]
	ans = solve(A, B)
	print(ans)


def do():
	q = int(input())
	for _ in range(q):
		(a, b) = map(int, input().split())
		x = a ^ b
		print(x)
do()


def test():
	a = list(map(int, input().split()))
	print(a[0] ^ a[1])
ttt = int(input())
for i in range(ttt):
	test()


import typing
import sys
import math
import collections
import bisect
import itertools
import heapq
import decimal
INF = 10 ** 20
MOD = 10 ** 9 + 7

def ni():
	return int(sys.stdin.buffer.readline())

def ns():
	return map(int, sys.stdin.buffer.readline().split())

def na():
	return list(map(int, sys.stdin.buffer.readline().split()))

def main():
	t = ni()
	for _ in range(t):
		(a, b) = ns()
		ans = 0
		for i in range(32):
			ta = a & 1 << i
			tb = b & 1 << i
			if ta == 0 and tb != 0 or (ta != 0 and tb == 0):
				ans += pow(2, i)
		print(ans)
main()


for x in range(int(input())):
	(h, m) = list(map(int, input().split()))
	v = 0
	for i in range(30):
		c = 0
		if h >> i & 1:
			c += 1
		if m >> i & 1:
			c += 1
		if c == 2:
			v += 1 << i
	print((h ^ v) + (m ^ v))


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split(' '))
	if a & b == 0:
		temp = a | b
		print((a ^ temp) + (b ^ temp))
	else:
		temp = a & b
		print((a ^ temp) + (b ^ temp))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	cur = ~a
	print(abs(cur ^ b) - 1)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			(x, y) = invr()
			print(x ^ y)
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	(ba, bb) = (bin(a)[2:], bin(b)[2:])
	ans = ''
	while len(ba) < len(bb):
		ba = '0' + ba
	while len(bb) < len(ba):
		bb = '0' + bb
	for i in range(len(ba)):
		if ba[i] != bb[i]:
			ans += '1'
		else:
			ans += '0'
	print(int(ans, 2))


from sys import stdin, stdout
n = int(stdin.readline())
for i in range(n):
	ans = 0
	(x, y) = map(int, stdin.readline().split())
	ans = x ^ y
	stdout.write(str(ans) + '\n')


from math import log2

def findX(arr, n):
	itr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itr:
			itr = arr[i]
	p = int(log2(itr)) + 1
	X = 0
	for i in range(p):
		count = 0
		for j in range(n):
			if arr[j] & 1 << i:
				count += 1
		if count > int(n / 2):
			X += 1 << i
	sum = 0
	for i in range(n):
		sum += X ^ arr[i]
	print(sum)

def main():
	test = int(input())
	for test_i in range(test):
		(a, b) = input().split()
		a = int(a)
		b = int(b)
		arr = [a, b]
		n = 2
		findX(arr, n)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	bin1 = list(str('{0:032b}'.format(a)))
	bin2 = list(str('{0:032b}'.format(b)))
	ans = ''
	for i in range(len(bin1)):
		if bin1[i] == bin2[i]:
			if bin1[i] == '0':
				ans += '0'
			else:
				ans += '1'
		else:
			ans += '0'
	ans = int(ans, 2)
	first = a ^ ans
	second = b ^ ans
	print(first + second)


import sys
t = int(input())
for tc in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


def solve():
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		return
	print(a ^ b)
for _ in range(int(input())):
	solve()


from sys import stdin, stdout
n = int(input())
while n:
	(a, b) = map(int, input().split())
	s = a ^ b
	print(s)
	n -= 1


def solve(a, b):
	x = a & b
	return (a ^ x) + (b ^ x)

def main():
	nt = int(input())
	for _ in range(nt):
		(a, b) = map(int, input().split())
		sol = solve(a, b)
		print(sol)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	Ba = bin(a)[2:]
	Bb = bin(b)[2:]
	s = ''
	Ba = Ba[::-1]
	Bb = Bb[::-1]
	for j in range(min(len(Ba), len(Bb))):
		if Ba[j] == '1' and Bb[j] == '1':
			s += '1'
		else:
			s += '0'
	s = s[::-1]
	x = int(s, 2)
	ans = a ^ x
	ans += b ^ x
	print(ans)


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	(a, b) = list(map(int, sys.stdin.readline().strip().split()))
	x = a & b
	print((a ^ x) + (b ^ x))


def solve():
	(a, b) = [int(x) for x in input().strip().split()]
	common = a & b
	return (a ^ common) + (b ^ common)
for _ in range(int(input().strip())):
	print(solve())


def eval(a, b):
	return a ^ b
t = int(input())
while t:
	(a, b) = map(int, input().split())
	print(eval(a, b))
	t -= 1


T = int(input())
for test in range(T):
	case = list(map(int, input().strip().split()))
	a = case[0]
	b = case[1]
	print(a ^ b)


for tests in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


a = int(input())
for x in range(a):
	(b, c) = map(int, input().split())
	print(b ^ c)


for x in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a == b == 1:
		print(0)
	elif a == 1 and b == 0 or (a == 0 and b == 1):
		print(1)
	else:
		m = max(a, b)
		s = bin(m).replace('0b', '')
		t = bin(min(a, b)).replace('0b', '')
		l1 = len(s)
		l2 = len(t)
		s = s[l1 - l2:]
		no = int(s, 2)
		print((a ^ no) + (b ^ no))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	s1 = bin(a)[2:][::-1]
	s2 = bin(b)[2:][::-1]
	s = ''
	for i in range(min(len(s1), len(s2))):
		if s2[i] == s1[i]:
			s += s2[i]
		else:
			s += '0'
	x = int(s[::-1], 2)
	print((a ^ x) + (b ^ x))


def ans(a, b):
	return a ^ b
m = int(input())
for j in range(m):
	arr = input().split()
	a = int(arr[0])
	b = int(arr[1])
	print(ans(a, b))


import os
import sys
from io import BytesIO, IOBase
_str = str
BUFSIZE = 8192

def str(x=b''):
	return x if type(x) is bytes else _str(x).encode()

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def inp():
	return sys.stdin.readline().rstrip()

def mpint():
	return map(int, inp().split(' '))

def itg():
	return int(inp())

def solve():
	(a, b) = mpint()
	return a ^ b

def main():
	for _ in range(itg()):
		print(solve())
DEBUG = 0
URL = 'https://codeforces.com/contest/1421/problem/0'
if DEBUG == 1:
	import requests
	from ACgenerator.Y_Test_Case_Runner import TestCaseRunner
	runner = TestCaseRunner(main, URL)
	inp = runner.input_stream
	print = runner.output_stream
	runner.checking()
elif DEBUG == 2:
	main()
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	main()


import sys
import itertools
import math
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))

def FX(A, B):
	(i, x) = (0, 0)
	while A or B:
		if A & 1 and B & 1:
			x += 1 << i
		A >>= 1
		B >>= 1
		i += 1
	return x
(n,) = I()
n = int(n)
while n:
	n -= 1
	(A, B) = I()
	X = FX(A, B)
	print((A ^ X) + (B ^ X))


from sys import stdin, stdout
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007

def solve():
	(a, b) = mp()
	print(a ^ b)
for _ in range(inp()):
	solve()


test_case_num = int(input())
for i in range(test_case_num):
	(a, b) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	print(x ^ y)


from sys import stdin
for i in range(int(stdin.readline())):
	(a, b) = map(int, stdin.readline().strip().split())
	print(a ^ b)


from collections import deque
for tt in range(int(input())):
	(a, b) = map(int, input().split())
	res = deque()
	c = max(a, b)
	res.append((a ^ c) + (b ^ c))
	for i in res:
		print(i)


import math
import sys, bisect
from heapq import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 6)
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	(a, b) = neo()
	(x, y) = (bin(a)[2:][::-1], bin(b)[2:][::-1])
	s = ''
	for i in range(min(len(x), len(y))):
		if x[i] == y[i] and x[i] == '1':
			s += '1'
		else:
			s += '0'
	s = int(s[::-1], 2)
	print((a ^ s) + (b ^ s))


def answer(a, b):
	x = a & b
	return (a ^ x) + (b ^ x)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(answer(a, b))


T = int(input())
while T != 0:
	(a, b) = [int(i) for i in input().split()]
	print(a ^ b)
	T -= 1


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	if a < b:
		print(b ^ a)
	else:
		print(a ^ b)


def main():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a < b:
			(a, b) = (b, a)
		(ba, bb) = (list(bin(a)[2:]), list(bin(b)[2:]))
		while len(bb) < len(ba):
			bb.insert(0, '0')
		bx = []
		for i in range(len(ba)):
			if ba[i] == bb[i]:
				if ba[i] == '0':
					bx.append('0')
				else:
					bx.append('1')
			else:
				bx.append('0')
		x = int(''.join(bx), 2)
		print((a ^ x) + (b ^ x))
main()


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	(x, y) = (bin(n)[2:], bin(m)[2:])
	(l, c) = ([], 0)
	d = {}
	for i in x[::-1]:
		if i == '1':
			d[c] = 1
		c += 1
	s = c = 0
	for i in y[::-1]:
		if i == '1':
			if c in d:
				s += 2 ** c
		c += 1
	print(n ^ s + (m ^ s))


for t in range(int(input())):
	d = 0
	(a, b) = map(int, input().split())
	d = a ^ b
	print(d)


tc = int(input())
for iii in range(tc):
	(a, b) = [int(i) for i in input().split()]
	temp = max(a, b)
	print((a ^ temp) + (b ^ temp))


t = int(input())
for _ in range(t):
	a = input().split()
	x = int(a[0]) & int(a[1])
	b = (int(a[0]) ^ x) + (int(a[1]) ^ x)
	print(b)


def values(a, b):
	return a ^ b
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	print(values(a, b))


from collections import defaultdict as dd
import sys
input = sys.stdin.readline
t = int(input())
while t:
	(a, b) = map(int, input().split())
	o = a | b
	print((o ^ a) + (o ^ b))
	t -= 1


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	n = a
	m = b
	x = 0
	curr = 1
	while a > 0 and b > 0:
		if a & 1 and b & 1:
			x += curr
		curr *= 2
		a = a >> 1
		b = b >> 1
	print((x ^ n) + (x ^ m))


for t__ in range(int(input())):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	print(min(a, b) ^ max(a, b))


t = int(input())
while t > 0:
	t -= 1
	inp = input().split(' ')
	a = int(inp[0])
	b = int(inp[1])
	print(a ^ b)


game = int(input())
for i in range(game):
	(a, b) = map(int, input().split())
	c = max(a, b)
	d = (a ^ c) + (b ^ c)
	print(d)


import sys

def main():
	testcases = int(sys.stdin.readline().strip())
	for i in range(testcases):
		(a, b) = [int(i) for i in sys.stdin.readline().split()]
		x = a & b
		print((a ^ x) + (b ^ x))
main()


def solve(a, b):
	return a ^ b
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	out = solve(a, b)
	print(out)


fptr = open(0)
for _ in range(int(next(fptr))):
	(a, b) = map(int, next(fptr).split())
	print(a ^ b)


def decimalToBinary(n):
	return bin(n).replace('0b', '')
n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	a = str(decimalToBinary(a))
	b = str(decimalToBinary(b))
	c = ''
	(l1, l2) = (len(a), len(b))
	for i in range(1, min(l1, l2) + 1):
		if a[l1 - i] == b[l2 - i]:
			c = '0' + c
		else:
			c = '1' + c
	if l2 > l1:
		for i in range(min(l1, l2) + 1, l2 + 1):
			if b[l2 - i] == '0':
				c = '0' + c
			else:
				c = '1' + c
	elif l1 > l2:
		for i in range(min(l1, l2) + 1, l1 + 1):
			if a[l1 - i] == '0':
				c = '0' + c
			else:
				c = '1' + c
	else:
		c = c
	c = int(c, 2)
	print(c)


k = int(input())
for i in range(k):
	(m, n) = map(int, input().split())
	print(m ^ n)


T = int(input())
for z in range(T):
	(A, B) = [int(x) for x in input().split()]
	x = A & B
	out = (A ^ x) + (B ^ x)
	print(out)


import sys, os.path
from collections import *
from copy import *
import math
import heapq
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
for t in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

def solve(a, b):
	c = 0
	for i in range(32):
		x = 1 << i
		ai = a & x
		bi = b & x
		if ai != bi:
			c |= x
	return c
T = int(input())
ans = []
for _ in range(T):
	(a, b) = map(int, input().split())
	ans.append(solve(a, b))
print('\n'.join(map(str, ans)))


import sys

def main():
	inp = sys.stdin.read().strip().split('\n')[1:]
	out = []
	for s in inp:
		(x, y) = map(int, s.split())
		out.append(x ^ y)
	return out
print(*main(), sep='\n')


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	g = math.gcd(a, b)
	r = min((a ^ g) + (b ^ g), a ^ b)
	print(r)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().strip().split())
	(a, b) = (str(bin(a))[2:], str(bin(b))[2:])
	(lenA, lenB) = (len(a), len(b))
	if lenA > lenB:
		b = '0' * (lenA - lenB) + b
	elif lenA < lenB:
		a = '0' * (lenB - lenA) + a
	val = 0
	length = max(lenA, lenB)
	for i in range(length):
		if a[i] != b[i]:
			val += 2 ** (length - 1 - i)
	print(val)


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def get_input(a=str):
	return a(input())

def get_int_input():
	return get_input(int)

def get_input_arr(a):
	return list(map(a, input().split()))

def get_int_input_arr():
	return get_input_arr(int)

def solve():
	t = get_int_input()
	for _ in range(t):
		(a, b) = get_int_input_arr()
		(m, n) = (a, b)
		x = 0
		pw = 0
		while a > 0 and b > 0:
			if a & 1 == b & 1:
				x = pow(2, pw) * (a & 1) + x
			pw += 1
			a = a >> 1
			b = b >> 1
		cout << (m ^ x) + (n ^ x) << endl

def main():
	solve()
main()


import sys
from collections import defaultdict, Counter as CC
from math import sqrt, ceil, floor, log2
INF = float('inf')
MOD = 10 ** 9 + 7
read = lambda : [int(s) for s in sys.stdin.readline().split()]

def solve():
	(a, b) = read()
	print(a ^ b)
_ = 1
_ = int(input())
while _:
	solve()
	_ -= 1


t = int(input())
for case in range(t):
	(a, b) = [int(x) for x in input().split(' ')]
	ans = a ^ b
	print(ans)


def get_input():
	return input().split(' ')

def get_int_input():
	return list(map(int, get_input()))
t = int(input())
for _ in range(t):
	(a, b) = get_int_input()
	print(a ^ b)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ba = bin(a)[2:]
	bb = bin(b)[2:]
	if len(ba) > len(bb):
		bb = '0' * (len(ba) - len(bb)) + bb
	else:
		ba = '0' * (len(bb) - len(ba)) + ba
	ans = 0
	ma = max(len(ba), len(bb))
	for ab in range(ma - 1, -1, -1):
		if ba[ab] != bb[ab]:
			ans += 2 ** (ma - ab - 1)
	print(ans)


a = int(input())
while a:
	a -= 1
	(b, c) = map(int, input().split())
	print(c ^ b)


def findX(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	x = findX(n, m)
	print((n ^ x) + (m ^ x))


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False
for _ in range(int(input())):
	(a, b) = getNM()
	x = a & b
	print((a ^ x) + (b ^ x))


mod = 10 ** 9 + 7
INF = float('inf')

def readInts():
	return list(map(int, input().split()))

def readTuples():
	return tuple(map(int, input().split()))

def I():
	return int(input())
q = I()
for _ in range(q):
	(a, b) = readInts()
	x = a & b
	print((a ^ x) + (b ^ x))


def solve():
	(a, b) = map(int, input().split())
	axor = a ^ 0
	bxor = b ^ 0
	print(axor ^ bxor)
	return

def main():
	t = int(input())
	for i in range(t):
		solve()
	return
main()


import sys
import bisect as bi
import collections as cc
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
for tcc in range(int(input())):
	(a, b) = I()
	ans = 0
	for i in range(0, 60):
		x = 1 if a & 1 << i else 0
		y = 1 if b & 1 << i else 0
		if x + y == 1:
			ans += pow(2, i)
	print(ans)


import sys
from heapq import heappush, heappop
from bisect import bisect_left as bi_l, bisect_right as bi_r
from collections import deque, Counter, defaultdict
import itertools
import string
import math
from operator import xor, or_
from functools import lru_cache, reduce
sys.setrecursionlimit(10 ** 7)
inf = float('inf')
MOD = 10 ** 9 + 7
using_numpy = 1

class Algebra:

	class Modular(int):

		def __init__(self, n, mod=MOD):
			self.value = n
			self.mod = mod

		def __str__(self):
			return f'{self.value}'

		def __add__(self, other):
			return self.__class__((self.value + other.value) % self.mod)

		def __sub__(self, x):
			return self.__class__((self.value - x.value) % self.mod)

		def __mul__(self, x):
			return self.__class__(self.value * x.value % self.mod)

		def __pow__(self, x):
			return self.__class__(pow(self.value, x.value, self.mod))

		def __lt__(self, x):
			return self.value < x.value

		def __le__(self, x):
			return self.value <= x.value

		def __eq__(self, x):
			return self.value == x.value

		def __ne__(self, x):
			return self.value != x.value

		def __gt__(self, x):
			return self.value > x.value

		def __ge__(self, x):
			return self.value >= x.value

	class SemiGroup:
		pass

	class Monoid:
		pass

	class Group:
		pass

	class SemiRing:
		pass

	class Ring:
		pass

	@staticmethod
	def identity(n):
		if using_numpy:
			return np.identity(n, dtype=np.int64)
		else:
			a = [[0] * n for _ in range(n)]
			for i in range(n):
				a[i][i] = 1
			return a

	@staticmethod
	def dot(a, b):
		if using_numpy:
			return np.dot(a, b)
		else:
			(h, w, l) = (len(a), len(b[0]), len(b))
			assert len(a[0]) == l
			c = [[0] * w for _ in range(h)]
			for i in range(h):
				for j in range(w):
					for k in range(l):
						c[i][j] += a[i][k] * b[k][j]
			return c

	@classmethod
	def matrix_pow(cls, a, n, mod=10 ** 9 + 7):
		m = len(a)
		b = cls.identity(m)
		while n:
			if n & 1:
				b = cls.dot(b, a)
			n >>= 1
			a = cls.dot(a, a)
			if using_numpy:
				a %= mod
				b %= mod
			else:
				for i in range(m):
					for j in range(m):
						a[i][j] %= mod
						b[i][j] %= mod
		return b

	@staticmethod
	def bitwise_dot(a, b):
		if using_numpy:
			return np.bitwise_xor.reduce(a[:, None, :] & b.T[None, :, :], axis=-1)
		else:
			(h, w, l) = (len(a), len(b[0]), len(b))
			assert len(a[0]) == l
			c = [[0] * w for _ in range(h)]
			for i in range(h):
				for j in range(w):
					for k in range(l):
						c[i][j] ^= a[i][k] & b[k][j]
			return c

	@classmethod
	def bitwise_mat_pow(cls, a, n):
		if n == 0:
			return np.eye(len(a), dtype=np.uint32) * ((1 << 32) - 1)
		res = cls.bitwise_mat_pow(a, n // 2)
		res = cls.bitwise_dot(res, res)
		return cls.bitwise_dot(res, a) if n & 1 else res

	class Kitamasa:
		pass
mint = Algebra.Modular

class NumberTheory:

	class PrimeNumbers:

		def __init__(self, n=2 * 10 ** 6):
			(self.is_prime, self.prime_nums) = self.find(n)

		def __call__(self, n):
			return self.is_prime[n]

		def __iter__(self):
			return iter(self.prime_nums)

		def __getitem__(self, key):
			return self.prime_nums[key]

		@staticmethod
		def find(n):
			if using_numpy:
				is_prime = np.ones(n + 1, dtype=np.bool)
				is_prime[:2] = 0
				for i in range(2, int(n ** 0.5) + 1):
					if is_prime[i]:
						is_prime[i * 2::i] = 0
				prime_nums = np.flatnonzero(is_prime)
			else:
				is_prime = [True] * (n + 1)
				is_prime[0] = is_prime[1] = 0
				for i in range(2, int(n ** 0.5) + 1):
					if not is_prime[i]:
						continue
					for j in range(i * 2, n + 1, i):
						is_prime[j] = 0
				prime_nums = [i for i in range(2, n + 1) if is_prime[i]]
			return (is_prime, prime_nums)

		@lru_cache(maxsize=None)
		def factorize(self, n):
			res = defaultdict(int)
			if n < 2:
				return res
			for p in self:
				if p * p > n:
					break
				while n % p == 0:
					res[p] += 1
					n //= p
				if n == 1:
					return res
			res[n] = 1
			return res

		def factorize_factorial(self, n):
			res = defaultdict(int)
			for i in range(2, n + 1):
				for (p, c) in self.factorize(i).items():
					res[p] += c
			return res

	@classmethod
	@lru_cache(maxsize=None)
	def gcd(cls, a, b):
		return cls.gcd(b, a % b) if b else abs(a)

	@classmethod
	def lcm(cls, a, b):
		return abs(a // cls.gcd(a, b) * b)

	@staticmethod
	def find_divisors(n):
		divisors = []
		for i in range(1, int(n ** 0.5) + 1):
			if n % i:
				continue
			divisors.append(i)
			j = n // i
			if j != i:
				divisors.append(j)
		return sorted(divisors)

	@staticmethod
	def base_convert(n, b):
		if not n:
			return [0]
		res = []
		while n:
			(n, r) = divmod(n, b)
			if r < 0:
				n += 1
				r -= b
			res.append(r)
		return res

class Combinatorics:

	@classmethod
	@lru_cache(maxsize=None)
	def choose(cls, n, r, mod=None):
		if r > n or r < 0:
			return 0
		if r == 0:
			return 1
		res = cls.choose(n - 1, r, mod) + cls.choose(n - 1, r - 1, mod)
		if mod:
			res %= mod
		return res

	class CombinationsMod:

		def __init__(self, n=2 * 10 ** 6, mod=MOD):
			self.__mod = mod
			self.__generate_fac_ifac(n)

		def __call__(self, n, r):
			return self.__choose(n, r)

		def __choose(self, n, r):
			p = self.__mod
			return self.__fac[n] * self.__ifac[r] % p * self.__ifac[n - r] % p

		def __cumprod(self, a):
			p = self.__mod
			l = len(a)
			sql = int(np.sqrt(l) + 1)
			a = np.resize(a, sql ** 2).reshape(sql, sql)
			for i in range(sql - 1):
				a[:, i + 1] *= a[:, i]
				a[:, i + 1] %= p
			for i in range(sql - 1):
				a[i + 1] *= a[i, -1]
				a[i + 1] %= p
			return np.ravel(a)[:l]

		def __generate_fac_ifac(self, n):
			p = self.__mod
			if using_numpy:
				fac = np.arange(n + 1)
				fac[0] = 1
				fac = self.__cumprod(fac)
				ifac = np.arange(n + 1, 0, -1)
				ifac[0] = pow(int(fac[-1]), p - 2, p)
				ifac = self.__cumprod(ifac)[n::-1]
			else:
				fac = [None] * (n + 1)
				fac[0] = 1
				for i in range(n):
					fac[i + 1] = fac[i] * (i + 1) % p
				ifac = [None] * (n + 1)
				ifac[n] = pow(fac[n], p - 2, p)
				for i in range(n, 0, -1):
					ifac[i - 1] = ifac[i] * i % p
			(self.__fac, self.__ifac) = (fac, ifac)

		def make_nchoose_table(self, n):
			p = self.__mod
			r = len(self.__fac) - 1
			if using_numpy:
				n_choose = np.arange(n + 1, n - r, -1)
				n_choose[0] = 1
				n_choose = self.__cumprod(n_choose) * self.__ifac % p
			else:
				n_choose = [None] * (r + 1)
				n_choose[0] = 1
				for i in range(r):
					n_choose[i + 1] = n_choose[i] * (n - i) % p
				for i in range(1, r + 1):
					n_choose[i] = n_choose[i] * self.__ifac[i] % p
			return n_choose

	@classmethod
	def permutations(cls, a, r=None, i=0):
		a = list(a)
		n = len(a)
		if r is None:
			r = n
		res = []
		if r > n or i > r:
			return res
		if i == r:
			return [tuple(a[:r])]
		for j in range(i, n):
			(a[i], a[j]) = (a[j], a[i])
			res += cls.permutations(a, r, i + 1)
		return res

	@staticmethod
	def combinations(a, r):
		a = tuple(a)
		n = len(a)
		if r > n:
			return
		indices = list(range(r))
		yield a[:r]
		while True:
			for i in range(r - 1, -1, -1):
				if indices[i] != i + n - r:
					break
			else:
				return
			indices[i] += 1
			for j in range(i + 1, r):
				indices[j] = indices[j - 1] + 1
			yield tuple((a[i] for i in indices))

class DP:

	@staticmethod
	def LIS(a):
		res = [inf] * len(a)
		for x in a:
			res[bi_l(res, x)] = x
		return res

class String:

	@staticmethod
	def z_algorithm(s):
		n = len(s)
		a = [0] * n
		a[0] = n
		l = r = -1
		for i in range(1, n):
			if r >= i:
				a[i] = min(a[i - l], r - i)
			while i + a[i] < n and s[i + a[i]] == s[a[i]]:
				a[i] += 1
			if i + a[i] >= r:
				(l, r) = (i, i + a[i])
		return a

class GeometryTopology:

	class Graph:

		class __Edge:

			def __init__(self, weight=1, capacity=1, **args):
				self.weight = weight
				self.capacity = capacity

		class __Node:

			def __init__(self, **args):
				pass

		def __init__(self, n=0):
			self.__N = n
			self.__nodes = [None] * n
			self.__edges = [{} for _ in range(n)]

		def add_node(self, v, **args):
			self.__nodes[v] = self.__Node(**args)

		def add_edge(self, u, v, **args):
			self.__edges[u][v] = self.__Edge(**args)

		def get_size(self):
			return self.__N

		def bfs(self, src=0):
			assert 0 <= src < self.__N
			self.__depth = self.__lv = lv = [None] * self.__N
			lv[src] = 0
			self.__dist = dist = [inf] * self.__N
			dist[src] = 0
			self.__parent = par = [None] * self.__N
			par[src] = src
			q = deque([src])
			while q:
				u = q.popleft()
				for (v, e) in self.__edges[u].items():
					if e.capacity == 0 or lv[v] is not None:
						continue
					lv[v] = lv[u] + 1
					dist[v] = dist[u] + e.weight
					par[v] = u
					q.append(v)
			return lv

		def dinic(self, src, sink):

			def flow_to_sink(u, flow_in):
				if u == sink:
					return flow_in
				flow = 0
				for (v, e) in self.__edges[u].items():
					if e.capacity == 0 or self.__lv[v] <= self.__lv[u]:
						continue
					f = flow_to_sink(v, min(flow_in, e.capacity))
					if not f:
						continue
					self.__edges[u][v].capacity -= f
					if u in self.__edges[v]:
						self.__edges[v][u].capacity += f
					else:
						self.add_edge(v, u, capacity=f)
					flow_in -= f
					flow += f
				return flow
			flow = 0
			while True:
				self.bfs(src)
				if self.__lv[sink] is None:
					return flow
				flow += flow_to_sink(src, inf)

		def ford_fulkerson(self):
			pass

		def push_relabel(self):
			pass

		def floyd_warshall(self):
			n = self.__N
			d = [[inf] * n for _ in range(n)]
			for u in range(n):
				d[u][u] = 0
				for (v, e) in self.__edges[u].items():
					d[u][v] = e.weight
			for w in range(n):
				for u in range(n):
					for v in range(n):
						d[u][v] = min(d[u][v], d[u][w] + d[w][v])
			return d

		def dijkstra(self, src, paths_cnt=False, mod=None):
			dist = [inf] * self.__N
			dist[src] = 0
			visited = [False] * self.__N
			paths = [0] * self.__N
			paths[src] = 1
			q = [(0, src)]
			while q:
				(d, u) = heappop(q)
				if visited[u]:
					continue
				visited[u] = True
				for (v, e) in self.__edges[u].items():
					dv = d + e.weight
					if dv > dist[v]:
						continue
					elif dv == dist[v]:
						paths[v] += paths[u]
						if mod:
							paths[v] %= mod
						continue
					(paths[v], dist[v]) = (paths[u], dv)
					heappush(q, (dv, v))
			if paths_cnt:
				return (dist, paths)
			else:
				return dist

		def astar(self, src, tgt, heuristic_func):
			cost = [inf] * self.__N
			q = [(heuristic_func(src, tgt), 0, src)]
			while q:
				(_, c, u) = heappop(q)
				if u == tgt:
					return c
				if cost[u] != inf:
					continue
				cost[u] = c
				for (v, e) in self.__edges[u].items():
					if cost[v] != inf:
						continue
					h = heuristic_func(v, tgt)
					nc = c + e.weight
					heappush(q, (h + nc, nc, v))
			return inf

		def find_ancestors(self):
			self.__ancestors = ancestors = [self.__parent]
			for _ in range(max(self.__depth).bit_length()):
				ancestors.append([ancestors[-1][u] for u in ancestors[-1]])

		def find_dist(self, u, v):
			return self.__dist[u] + self.__dist[v] - 2 * self.__dist[self.__find_lca(u, v)]

		def __find_lca(self, u, v):
			(du, dv) = (self.__depth[u], self.__depth[v])
			if du > dv:
				(u, v) = (v, u)
				(du, dv) = (dv, du)
			d = dv - du
			for i in range(d.bit_length()):
				if d >> i & 1:
					v = self.__ancestors[i][v]
			if v == u:
				return v
			for i in range(du.bit_length() - 1, -1, -1):
				(nu, nv) = (self.__ancestors[i][u], self.__ancestors[i][v])
				if nu == nv:
					continue
				(u, v) = (nu, nv)
			return self.__ancestors[0][u]

	@staticmethod
	def triangle_area(p0, p1, p2, signed=False):
		(x1, y1, x2, y2) = (p1[0] - p0[0], p1[1] - p0[1], p2[0] - p0[0], p2[1] - p0[1])
		return (x1 * y2 - x2 * y1) / 2 if signed else abs(x1 * y2 - x2 * y1) / 2

	@classmethod
	def intersect(cls, seg1, seg2):
		((p1, p2), (p3, p4)) = (seg1, seg2)
		t1 = cls.triangle_area(p1, p2, p3, signed=True)
		t2 = cls.triangle_area(p1, p2, p4, signed=True)
		t3 = cls.triangle_area(p3, p4, p1, signed=True)
		t4 = cls.triangle_area(p3, p4, p2, signed=True)
		return (t1 * t2 < 0) & (t3 * t4 < 0)

	class UnionFind:

		def __init__(self, n=10 ** 6):
			self.parent = list(range(n))
			self.rank = [0] * n
			self.size = [1] * n

		def find(self, u):
			if self.parent[u] == u:
				return u
			self.parent[u] = self.find(self.parent[u])
			return self.parent[u]

		def unite(self, u, v):
			(u, v) = (self.find(u), self.find(v))
			if u == v:
				return
			if self.rank[u] < self.rank[v]:
				(u, v) = (v, u)
			self.parent[v] = u
			self.size[u] += self.size[v]
			self.rank[u] = max(self.rank[u], self.rank[v] + 1)

def cumxor(a):
	return reduce(xor, a, 0)

def cumor(a):
	return reduce(or_, a, 0)

def bit_count(n):
	cnt = 0
	while n:
		cnt += n & 1
		n >>= 1
	return cnt

class AtCoder:

	class ABC001:

		@staticmethod
		def a():
			(h1, h2) = map(int, sys.stdin.read().split())
			print(h1 - h2)

		@staticmethod
		def d():

			def to_minuites(x):
				(q, r) = divmod(x, 100)
				return 60 * q + r

			def to_hmform(x):
				(q, r) = divmod(x, 60)
				return 100 * q + r
			n = int(sys.stdin.readline().rstrip())
			term = [0] * 2001
			for _ in range(n):
				(s, e) = map(to_minuites, map(int, sys.stdin.readline().rstrip().split('-')))
				s = s // 5 * 5
				e = (e + 4) // 5 * 5
				term[s] += 1
				term[e + 1] -= 1
			for i in range(2000):
				term[i + 1] += term[i]
			res = []
			raining = False
			for i in range(2001):
				if term[i]:
					if not raining:
						s = i
						raining = True
				elif raining:
					res.append((s, i - 1))
					raining = False
			for (s, e) in res:
				print(f'{to_hmform(s):04}-{to_hmform(e):04}')

	class ABC002:

		@staticmethod
		def a():
			print(max(map(int, sys.stdin.readline().split())))

		@staticmethod
		def b():
			vowels = set('aeiou')
			print(''.join([c for c in sys.stdin.readline().rstrip() if c not in vowels]))

		@staticmethod
		def c():
			print(GeometryTopology.triangle_area(*map(int, sys.stdin.readline().split())))

		@staticmethod
		def d():
			(n, m) = map(int, sys.stdin.readline().split())
			edges = set(((x - 1, y - 1) for (x, y) in zip(*[map(int, sys.stdin.read().split())] * 2)))
			print(max((len(s) for i in range(1, 1 << n) for s in [[j for j in range(n) if i >> j & 1]] if all(((x, y) in edges for (x, y) in itertools.combinations(s, 2))))))

		@staticmethod
		def d_2():
			(n, m) = map(int, sys.stdin.readline().split())
			relations = [1 << i for i in range(n)]
			for (x, y) in zip(*[map(int, sys.stdin.read().split())] * 2):
				relations[x] |= 1 << y - 1
				relations[y] |= 1 << x - 1
			res = 0
			for i in range(1 << n):
				(s, cnt) = ((1 << n) - 1, 0)
				for j in range(n):
					if i >> j & 1:
						t &= relations[j] | 1 << j
						cnt += 1
				if s & i == i:
					res = max(res, cnt)
			print(res)

	class ABC003:

		@staticmethod
		def a():
			print((int(sys.stdin.readline().rstrip()) + 1) * 5000)

		@staticmethod
		def b():
			atcoder = set('atcoder')
			(s, t) = sys.stdin.read().split()
			print(all((s[i] == t[i] or (s[i] == '@' and t[i] in atcoder) or (t[i] == '@' and s[i] in atcoder) for i in range(len(s)))) and 'You can win' or 'You will lose')

		@staticmethod
		def c():
			(n, k, *r) = map(int, sys.stdin.read().split())
			print(reduce(lambda x, y: (x + y) / 2, sorted(r)[-k:], 0))

	class ABC004:

		@staticmethod
		def a():
			print(int(sys.stdin.readline().rstrip()) * 2)

		@staticmethod
		def b():
			for l in [sys.stdin.readline().rstrip() for _ in range(4)][::-1]:
				print(l[::-1])

		@staticmethod
		def c():
			n = int(sys.stdin.readline().rstrip()) % 30
			res = list(range(1, 7))
			for i in range(n):
				i %= 5
				(res[i], res[i + 1]) = (res[i + 1], res[i])
			print(*res, sep='')

	class ABC005:

		@staticmethod
		def a():
			(x, y) = map(int, sys.stdin.readline().split())
			print(y // x)

		@staticmethod
		def b():
			(n, *t) = map(int, sys.stdin.read().split())
			print(min(t))

		@staticmethod
		def c():
			t = int(sys.stdin.readline().rstrip())
			n = int(sys.stdin.readline().rstrip())
			a = [int(x) for x in sys.stdin.readline().split()]
			m = int(sys.stdin.readline().rstrip())
			b = [int(x) for x in sys.stdin.readline().split()]
			i = 0
			for p in b:
				if i == n:
					print('no')
					return
				while p - a[i] > t:
					i += 1
					if i == n:
						print('no')
						return
				if a[i] > p:
					print('no')
					return
				i += 1
			print('yes')

		@staticmethod
		def d():
			n = int(sys.stdin.readline().rstrip())
			d = np.array([sys.stdin.readline().split() for _ in range(n)], np.int64)
			s = d.cumsum(axis=0).cumsum(axis=1)
			s = np.pad(s, 1)
			max_del = np.zeros((n + 1, n + 1), dtype=np.int64)
			for y in range(1, n + 1):
				for x in range(1, n + 1):
					max_del[y, x] = np.amax(s[y:n + 1, x:n + 1] - s[0:n - y + 1, x:n + 1] - s[y:n + 1, 0:n - x + 1] + s[0:n - y + 1, 0:n - x + 1])
			res = np.arange(n ** 2 + 1)[:, None]
			i = np.arange(1, n + 1)
			res = max_del[i, np.minimum(res // i, n)].max(axis=1)
			q = int(sys.stdin.readline().rstrip())
			p = np.array(sys.stdin.read().split(), dtype=np.int64)
			print(*res[p], sep='\n')

	class ABC006:

		@staticmethod
		def a():
			n = sys.stdin.readline().rstrip()
			if '3' in n:
				print('YES')
			elif int(n) % 3 == 0:
				print('YES')
			else:
				print('NO')

		@staticmethod
		def b():
			mod = 10007
			a = np.eye(N=3, k=-1, dtype=np.int64)
			a[0] = 1
			n = int(sys.stdin.readline().rstrip())
			a = Algebra.matrix_pow(a, n - 1, mod)
			print(a[2][0])

		@staticmethod
		def c():
			(n, m) = map(int, sys.stdin.readline().split())
			cnt = [0, 0, 0]
			if m == 1:
				cnt = [-1, -1, -1]
			else:
				if m & 1:
					m -= 3
					cnt[1] += 1
					n -= 1
				cnt[2] = m // 2 - n
				cnt[0] = n - cnt[2]
			if cnt[0] < 0 or cnt[1] < 0 or cnt[2] < 0:
				print(-1, -1, -1)
			else:
				print(*cnt, sep=' ')

		@staticmethod
		def d():
			(n, *c) = map(int, sys.stdin.read().split())
			lis = [inf] * n
			for x in c:
				lis[bi_l(lis, x)] = x
			print(n - bi_l(lis, inf))

	class ABC007:

		@staticmethod
		def a():
			n = int(sys.stdin.readline().rstrip())
			print(n - 1)

		@staticmethod
		def b():
			s = sys.stdin.readline().rstrip()
			if s == 'a':
				print(-1)
			else:
				print('a')

		@staticmethod
		def c():
			(r, c) = map(int, sys.stdin.readline().split())
			(sy, sx) = map(int, sys.stdin.readline().split())
			(gy, gx) = map(int, sys.stdin.readline().split())
			sy -= 1
			sx -= 1
			gy -= 1
			gx -= 1
			maze = [sys.stdin.readline().rstrip() for _ in range(r)]
			queue = deque([(sy, sx)])
			dist = np.full((r, c), np.inf)
			dist[sy, sx] = 0
			while queue:
				(y, x) = queue.popleft()
				for (i, j) in [(-1, 0), (1, 0), (0, -1), (0, 1)]:
					i += y
					j += x
					if maze[i][j] == '#' or dist[i, j] != np.inf:
						continue
					dist[i, j] = dist[y, x] + 1
					queue.append((i, j))
			print(int(dist[gy, gx]))

		@staticmethod
		def d():
			ng = set([4, 9])

			def count(d):
				return d if d <= 4 else d - 1

			def f(n):
				x = [int(d) for d in str(n)]
				flg = True
				dp = 0
				for d in x:
					dp = dp * 8 + flg * count(d)
					if d in ng:
						flg = False
				return n - (dp + flg)
			(a, b) = map(int, sys.stdin.readline().split())
			print(f(b) - f(a - 1))

	class ABC008:

		@staticmethod
		def a():
			(s, t) = map(int, sys.stdin.readline().split())
			print(t - s + 1)

		@staticmethod
		def b():
			(n, *s) = sys.stdin.read().split()
			res = defaultdict(int)
			for name in s:
				res[name] += 1
			print(sorted(res.items(), key=lambda x: x[1])[-1][0])

		@staticmethod
		def c():
			(n, *a) = map(int, sys.stdin.read().split())
			a = np.array(a)
			c = n - np.count_nonzero(a[:, None] % a, axis=1)
			print(np.sum((c + 1) // 2 / c))

		@staticmethod
		def d():
			(w, h, n, *xy) = map(int, sys.stdin.read().split())
			(*xy,) = zip(*[iter(xy)] * 2)

			@lru_cache(maxsize=None)
			def count(x1, y1, x2, y2):
				res = 0
				for (x, y) in xy:
					if not (x1 <= x <= x2 and y1 <= y <= y2):
						continue
					cnt = x2 - x1 + (y2 - y1) + 1
					cnt += count(x1, y1, x - 1, y - 1)
					cnt += count(x1, y + 1, x - 1, y2)
					cnt += count(x + 1, y1, x2, y - 1)
					cnt += count(x + 1, y + 1, x2, y2)
					res = max(res, cnt)
				return res
			print(count(1, 1, w, h))

	class ABC172:

		@staticmethod
		def a():
			a = int(sys.stdin.readline().rstrip())
			print(a * (1 + a + a ** 2))

		@staticmethod
		def b():
			(s, t) = sys.stdin.read().split()
			print(sum((s[i] != t[i] for i in range(len(s)))))

		@staticmethod
		def c():
			(n, m, k) = map(int, sys.stdin.readline().split())
			a = [0] + [int(x) for x in sys.stdin.readline().split()]
			b = [int(x) for x in sys.stdin.readline().split()]
			(*sa,) = itertools.accumulate(a)
			(*sb,) = itertools.accumulate(b)
			res = 0
			for i in range(n + 1):
				r = k - sa[i]
				if r < 0:
					break
				res = max(res, i + bi_r(sb, r))
			print(res)

		@staticmethod
		def d():
			n = int(sys.stdin.readline().rstrip())
			f = np.zeros(n + 1, dtype=np.int64)
			for i in range(1, n + 1):
				f[i::i] += 1
			print((np.arange(1, n + 1) * f[1:]).sum())

	class ABC173:

		@staticmethod
		def a():
			n = int(sys.stdin.readline().rstrip())
			charge = (n + 999) // 1000 * 1000 - n
			print(charge)

		@staticmethod
		def b():
			(n, *s) = sys.stdin.read().split()
			c = Counter(s)
			for v in 'AC, WA, TLE, RE'.split(', '):
				print(f'{v} x {c[v]}')

		@staticmethod
		def c():
			(h, w, k) = map(int, sys.stdin.readline().split())
			c = [sys.stdin.readline().rstrip() for _ in range(h)]
			tot = 0
			for i in range(1 << h):
				for j in range(1 << w):
					cnt = 0
					for y in range(h):
						for x in range(w):
							if i >> y & 1 or j >> x & 1:
								continue
							cnt += c[y][x] == '#'
					tot += cnt == k
			print(tot)

		@staticmethod
		def d():
			(n, *a) = map(int, sys.stdin.read().split())
			a.sort(reverse=True)
			res = a[0] + sum(a[1:1 + (n - 2) // 2]) * 2 + a[1 + (n - 2) // 2] * (n & 1)
			print(res)

		@staticmethod
		def e():
			MOD = 10 ** 9 + 7
			(n, k, *a) = map(int, sys.stdin.read().split())
			minus = [x for x in a if x < 0]
			plus = [x for x in a if x > 0]
			if len(plus) + len(minus) // 2 * 2 >= k:
				(*minus,) = map(abs, minus)
				minus.sort(reverse=True)
				plus.sort(reverse=True)
				cand = []
				if len(minus) & 1:
					minus = minus[:-1]
				for i in range(0, len(minus) - 1, 2):
					cand.append(minus[i] * minus[i + 1] % MOD)
				if k & 1:
					res = plus[0]
					plus = plus[1:]
				else:
					res = 1
				if len(plus) & 1:
					plus = plus[:-1]
				for i in range(0, len(plus) - 1, 2):
					cand.append(plus[i] * plus[i + 1] % MOD)
				cand.sort(reverse=True)
				for x in cand[:k // 2]:
					res *= x
					res %= MOD
				print(res)
			elif 0 in a:
				print(0)
			else:
				cand = sorted(map(abs, a))
				res = 1
				for i in range(k):
					res *= cand[i]
					res %= MOD
				res = MOD - res
				print(res)
				pass

	class ABC174:

		@staticmethod
		def a():
			print('Yes' if int(sys.stdin.readline().rstrip()) >= 30 else 'No')

	class ABC178:

		@staticmethod
		def a():
			pass

		@staticmethod
		def b():
			pass

		@staticmethod
		def c():
			pass

		@staticmethod
		def d():
			s = int(sys.stdin.readline().rstrip())
			if s == 0:
				print(1)
				return
			elif s == 1:
				print(0)
				return
			c = np.eye(3, k=-1, dtype=np.int64)
			c[0, 0] = c[0, 2] = 1
			a = np.array([0, 0, 1])
			print(Algebra.dot(Algebra.matrix_pow(c, s - 2), a)[0])

	class ABC179:

		@staticmethod
		def a():
			s = sys.stdin.readline().rstrip()
			print(s + 's' if s[-1] != 's' else s + 'es')

		@staticmethod
		def b():
			(n, *d) = map(int, sys.stdin.read().split())
			d = np.array(d).reshape(n, 2).T
			d = np.equal(d[0], d[1]).astype(int)
			dd = d.copy()
			dd[1:] += d[:-1]
			dd[:-1] += d[1:]
			print('Yes' if (dd >= 3).any() else 'No')

		@staticmethod
		def c():
			n = int(sys.stdin.readline().rstrip())
			print(sum((len(NumberTheory.find_divisors(i)) for i in range(1, n))))

		@staticmethod
		def d():
			mod = 998244353
			(n, k, *lr) = map(int, sys.stdin.read().split())
			(l, r) = np.array(lr).reshape(k, -1).T

			@njit((i8, i8[:], i8[:]), cache=True)
			def solve(n, l, r):
				res = np.zeros(n * 2, dtype=np.int64)
				(res[0], res[1]) = (1, -1)
				for i in range(n - 1):
					res[i + 1] = (res[i + 1] + res[i]) % mod
					res[i + l] = (res[i + l] + res[i]) % mod
					res[i + r + 1] = (res[i + r + 1] - res[i]) % mod
				print(res[n - 1])
			solve(n, l, r)

		@staticmethod
		def e():
			(n, x, m) = map(int, sys.stdin.readline().split())
			res = [-1 for _ in range(m)]
			s = 0
			loop = np.zeros(m, dtype=np.int64)
			for i in range(m + 1):
				if i == n:
					print(s)
					return
				if res[x] != -1:
					(l, loop) = (i - res[x], loop[res[x]:i])
					(q, r) = divmod(n - i, l)
					print(s + q * loop.sum() + loop[:r].sum())
					return
				(res[x], loop[i]) = (i, x)
				s += x
				x = x ** 2 % m

	class ABC180:

		@staticmethod
		def a():
			(n, a, b) = map(int, sys.stdin.readline().split())
			print(n - a + b)

		@staticmethod
		def b():
			(n, *x) = map(int, sys.stdin.read().split())
			x = np.absolute(np.array(x))
			print(x.sum())
			print(np.sqrt((x ** 2).sum()))
			print(x.max())

		@staticmethod
		def c():
			n = int(sys.stdin.readline().rstrip())
			div = NumberTheory.find_divisors(n)
			print(*div, sep='\n')

		@staticmethod
		def d():
			(x, y, a, b) = map(int, sys.stdin.readline().split())
			cnt = 0
			while x * a <= x + b:
				x *= a
				if x >= y:
					print(cnt)
					return
				cnt += 1
			cnt += (y - x - 1) // b
			print(cnt)

		@staticmethod
		def e():
			(n, *xyz) = map(int, sys.stdin.read().split())
			xyz = list(zip(*[iter(xyz)] * 3))
			dist = [[0] * n for _ in range(n)]
			for i in range(n):
				(a, b, c) = xyz[i]
				for j in range(n):
					(p, q, r) = xyz[j]
					dist[i][j] = abs(p - a) + abs(q - b) + max(0, r - c)
			dp = [[inf] * n for _ in range(1 << n)]
			dp[0][0] = 0
			for s in range(1 << n):
				for i in range(n):
					t = s | 1 << i
					for j in range(n):
						dp[t][i] = min(dp[t][i], dp[s][j] + dist[j][i])
			print(dp[-1][0])

		@staticmethod
		def f():
			(n, m, l) = map(int, sys.stdin.readline().split())
			c = Combinatorics.CombinationsMod(n, MOD)
			path = np.zeros(n + 1, dtype=np.int64)
			path[1] = path[2] = 1
			for i in range(3, n + 1):
				path[i] = path[i - 1] * i % MOD
			cycle = np.zeros(n + 1, dtype=np.int64)
			cycle[1:] = path[:-1]
			dp = np.zeros((n + 1, m + 1), dtype=np.int64)

			def f(l):
				dp[:, :] = 0
				dp[0, 0] = 1
				for i in range(n):
					for j in range(m + 1):
						k = np.arange(1, min(l, n - i, m - j + 1) + 1)
						dp[i + k, j + k - 1] += dp[i, j] * c(n - i - 1, k - 1) % MOD * path[k] % MOD
						dp[i + k, j + k - 1] %= MOD
						k = np.arange(2, min(l, n - i, m - j) + 1)
						dp[i + k, j + k] += dp[i, j] * c(n - i - 1, k - 1) % MOD * cycle[k] % MOD
						dp[i + k, j + k] %= MOD
				return dp[n, m]
			print((f(l) - f(l - 1)) % MOD)

		@staticmethod
		def f_2():
			(n, m, l) = map(int, sys.stdin.readline().split())
			c = Combinatorics.CombinationsMod(n, MOD)
			path = [0] * (n + 1)
			path[1] = path[2] = 1
			for i in range(3, n + 1):
				path[i] = path[i - 1] * i % MOD
			cycle = [0] + path[:-1]

			def f(l):
				dp = [[0] * (m + 1) for _ in range(n + 1)]
				dp[0][0] = 1
				for i in range(n):
					for j in range(m + 1):
						for k in range(1, min(l, n - i, m - j + 1) + 1):
							dp[i + k][j + k - 1] += dp[i][j] * c(n - i - 1, k - 1) % MOD * path[k] % MOD
							dp[i + k][j + k - 1] %= MOD
						for k in range(1, min(l, n - i, m - j) + 1):
							dp[i + k][j + k] += dp[i][j] * c(n - i - 1, k - 1) % MOD * cycle[k] % MOD
							dp[i + k][j + k] %= MOD
				return dp[n][m]
			print((f(l) - f(l - 1)) % MOD)

	class ACL001:

		@staticmethod
		def a():
			(n, *xy) = map(int, sys.stdin.read().split())
			(*xy,) = zip(*[iter(xy)] * 2)
			print(xy)
			pass

	class TDPC:

		@staticmethod
		def t():
			pass

	class MSolutions2020:

		@staticmethod
		def a():
			x = int(sys.stdin.readline().rstrip())
			x -= 400
			print(8 - x // 200)

		@staticmethod
		def b():
			(r, g, b, k) = map(int, sys.stdin.read().split())
			while k and g <= r:
				g *= 2
				k -= 1
			while k and b <= g:
				b *= 2
				k -= 1
			print('Yes' if r < g < b else 'No')

		@staticmethod
		def c():
			(n, k, *a) = map(int, sys.stdin.read().split())
			for i in range(k, n):
				print('Yes' if a[i] > a[i - k] else 'No')

		@staticmethod
		def d():
			(n, *a) = map(int, sys.stdin.read().split())
			a += [-1]
			m = 1000
			s = 0
			for i in range(n):
				if a[i + 1] == a[i]:
					continue
				elif a[i + 1] > a[i]:
					cnt = m // a[i]
					m -= a[i] * cnt
					s += cnt
				else:
					m += a[i] * s
					s = 0
			print(m)

class Codeforces:

	class cr676div2:

		@staticmethod
		def a():
			t = int(sys.stdin.readline().rstrip())
			for _ in range(t):
				(a, b) = map(int, sys.stdin.readline().split())
				print(a ^ b)

		@staticmethod
		def b():
			pass

		@staticmethod
		def c():
			pass

class ProjectEuler:

	@staticmethod
	def p1():

		def f(n, x):
			return (x + n // x * x) * (n // x) // 2
		n = 1000
		ans = f(n - 1, 3) + f(n - 1, 5) - f(n - 1, 15)
		print(ans)

	@staticmethod
	def p2():
		fib = [1, 2]
		while fib[-1] < 4 * 10 ** 6:
			fib.append(fib[-1] + fib[-2])
		print(sum(fib[1:-1:3]))

	@staticmethod
	def p3():
		pn = NumberTheory.PrimeNumbers()
		res = pn.factorize(600851475143)
		print(max(res.keys()))

	@staticmethod
	def p4():

		def is_palindrome(n):
			n = str(n)
			return n == n[::-1]
		cand = []
		for a in range(100, 1000):
			for b in range(a, 1000):
				n = a * b
				if is_palindrome(n):
					cand.append(n)
		print(max(cand))

	@staticmethod
	def p5():
		pn = NumberTheory.PrimeNumbers()
		res = defaultdict(int)
		for i in range(1, 21):
			for (p, c) in pn.factorize(i).items():
				res[p] = max(res[p], c)
		ans = 1
		for (p, c) in res.items():
			ans *= pow(p, c)
		print(ans)

	@staticmethod
	def p6():
		a = np.arange(101)
		b = np.cumsum(a ** 2)
		a = a.cumsum()
		print(a[100] ** 2 - b[100])

	@staticmethod
	def p7():
		nt = NumberTheory.PrimeNumbers()
		print(sorted(nt)[10000])

	@staticmethod
	def p8():
		n = '7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450'
		n = [int(d) for d in list(n)]
		res = 0
		for i in range(988):
			x = 1
			for j in range(13):
				x *= n[i + j]
			res = max(res, x)
		print(res)

	@staticmethod
	def p9():
		for a in range(1, 997):
			for b in range(a, 998 - a):
				c = 1000 - a - b
				if a ** 2 + b ** 2 == c ** 2:
					print(a * b * c)
					return

	@staticmethod
	def p10():
		pn = NumberTheory.PrimeNumbers(2 * 10 ** 6 + 1)
		print(sum(pn))

	@staticmethod
	def p11():
		grid = '08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80 24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50 32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70 67 26 20 68 02 62 12 20 95 63 94 39 63 08 40 91 66 49 94 21 24 55 58 05 66 73 99 26 97 17 78 78 96 83 14 88 34 89 63 72 21 36 23 09 75 00 76 44 20 45 35 14 00 61 33 97 34 31 33 95 78 17 53 28 22 75 31 67 15 94 03 80 04 62 16 14 09 53 56 92 16 39 05 42 96 35 31 47 55 58 88 24 00 17 54 24 36 29 85 57 86 56 00 48 35 71 89 07 05 44 44 37 44 60 21 58 51 54 17 58 19 80 81 68 05 94 47 69 28 73 92 13 86 52 17 77 04 89 55 40 04 52 08 83 97 35 99 16 07 97 57 32 16 26 26 79 33 27 98 66 88 36 68 87 57 62 20 72 03 46 33 67 46 55 12 32 63 93 53 69 04 42 16 73 38 25 39 11 24 94 72 18 08 46 29 32 40 62 76 36 20 69 36 41 72 30 23 88 34 62 99 69 82 67 59 85 74 04 36 16 20 73 35 29 78 31 90 01 74 31 49 71 48 86 81 16 23 57 05 54 01 70 54 71 83 51 54 69 16 92 33 48 61 43 52 01 89 19 67 48'
		print(grid)
	pass

class Yukicoder:

	def __init__(self):
		pass

	def __call__(self):
		print(1)
Codeforces.cr676div2.a()


from math import log2

def findXor(arr, n):
	itrr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itrr:
			itrr = arr[i]
	p = int(log2(itrr)) + 1
	X = 0
	for i in range(p):
		count = 0
		for j in range(n):
			if arr[j] & 1 << i:
				count += 1
		if count > int(n / 2):
			X += 1 << i
	summ = 0
	for i in range(n):
		summ += X ^ arr[i]
	print(summ)
for _ in range(int(input())):
	arr = list(map(int, input().split()))
	findXor(arr, len(arr))


t = int(input())
answers = []
for _ in range(t):
	ab = input().split()
	a_binary = bin(int(ab[0]))[2:]
	b_binary = bin(int(ab[1]))[2:]
	if len(str(a_binary)) != len(str(b_binary)):
		if len(str(a_binary)) < len(str(b_binary)):
			a_binary = (len(b_binary) - len(a_binary)) * '0' + a_binary
		else:
			b_binary = (len(a_binary) - len(b_binary)) * '0' + b_binary
	x = 0
	for i in range(1, len(a_binary) + 1):
		if a_binary[-i] != b_binary[-i]:
			x += 2 ** (i - 1)
	answers.append(x)
for j in range(t):
	print(answers[j])


t = int(input())
results = []
for i in range(t):
	vals = input().split()
	a = int(vals[0])
	b = int(vals[1])
	results.append(a ^ b)
for res in results:
	print(res)


t = input()
for k in range(int(t)):
	h = []
	ch = input()
	h = [int(i) for i in ch.split()]
	a = (h[0] ^ h[0] & h[1]) + (h[1] ^ h[0] & h[1])
	print(a)


def minx(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = minx(a, b)
	print((a ^ x) + (b ^ x))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(x, result1, result2) = ('', '', '')
	(a_bin, b_bin) = (str(bin(a))[2:], str(bin(b))[2:])
	if len(a_bin) < len(b_bin):
		a_bin = '0' * abs(len(a_bin) - len(b_bin)) + a_bin
	elif len(b_bin) < len(a_bin):
		b_bin = '0' * abs(len(a_bin) - len(b_bin)) + b_bin
	for i in range(len(max(a_bin, b_bin))):
		if a_bin[i] == b_bin[i] == '1':
			x += '1'
		else:
			x += '0'
	for i in range(len(x)):
		if a_bin[i] != x[i]:
			result1 += '1'
		else:
			result1 += '0'
		if b_bin[i] != x[i]:
			result2 += '1'
		else:
			result2 += '0'
	result1 = '0b' + result1
	result2 = '0b' + result2
	print(int(result1, 2) + int(result2, 2))


import sys, collections, math, itertools, random
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	(l, r) = get_ints()
	mx = max(l, r)
	print((l ^ mx) + (r ^ mx))


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	s1 = bin(a)
	s2 = bin(b)
	if s1.find('0') != -1:
		n1 = int(s1[s1.find('0'):], 2)
	else:
		n1 = 1
	if s2.find('0') != -1:
		n2 = int(s2[s2.find('0'):], 2)
	else:
		n2 = 1
	if (a ^ n1) + (b ^ n1) > (a ^ n2) + (b ^ n2):
		print((a ^ n2) + (b ^ n2))
	else:
		print((a ^ n1) + (b ^ n1))


from math import log2

def findX(arr, n):
	itr = arr[0]
	for i in range(len(arr)):
		if arr[i] > itr:
			itr = arr[i]
	p = int(log2(itr)) + 1
	X = 0
	for i in range(p):
		count = 0
		for j in range(n):
			if arr[j] & 1 << i:
				count += 1
		if count > int(n / 2):
			X += 1 << i
	sum = 0
	for i in range(n):
		sum += X ^ arr[i]
	print(sum)
t = int(input())
for i in range(t):
	ar = input().split()
	arr = [int(i) for i in ar]
	n = len(arr)
	findX(arr, n)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	c = max(a, b)
	print((a ^ c) + (b ^ c))


a = int(input())
ans = []
for i in range(a):
	now = [int(x) for x in input().split()]
	ans.append(now[0] ^ now[1])
for i in ans:
	print(i)


a = int(input())
for i in range(0, a):
	(a, b) = map(int, input().split())
	a1 = bin(a)[2:]
	a2 = bin(b)[2:]
	ans = []
	for i in range(0, max(len(a1), len(a2))):
		o = 0
		t = 0
		if len(a1) > i:
			o = int(a1[len(a1) - i - 1])
		if len(a2) > i:
			t = int(a2[len(a2) - i - 1])
		if o + t == 2:
			ans.append(1)
		else:
			ans.append(0)
	ans = ans[::-1]
	ans = ''.join(list(map(str, ans)))
	ta = int(ans, 2)
	a1 = a ^ ta
	a2 = b ^ ta
	print(a1 + a2)


def solve(a, b):
	return a ^ b

def main():
	for _ in range(int(input())):
		print(solve(*map(int, input().split())))
main()


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	print(n ^ k)


n = eval(input())
for i in range(n):
	(a, b) = input().split(' ')
	a = eval(a)
	b = eval(b)
	c = a | b
	res = (a ^ c) + (b ^ c)
	print(res)


import os
import sys
from io import BytesIO, IOBase
import math

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c
for xyz in range(0, int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


for case in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	if a < b:
		(a, b) = (b, a)
	print((a ^ a) + (b ^ a))


exec('a,b=map(int,input().split());print(a^b);' * int(input()))


t = int(input())
for t1 in range(0, t):
	(x, y) = map(int, input().split())
	print(x ^ y)


t = int(input())
h = 1
while h <= t:
	(a, b) = map(int, input().split())
	if a < b:
		print(b ^ a)
	else:
		print(a ^ b)
	h += 1


import sys
import math
import itertools
import copy
import collections
input = sys.stdin.readline
T = int(input())
for case in range(T):
	(a, b) = map(int, input().split())
	s1 = bin(a)
	s2 = bin(b)
	(s1, s2) = (s1[2:], s2[2:])
	(s1, s2) = (s1[::-1], s2[::-1])
	ans = ''
	for i in range(min(len(s1), len(s2))):
		if s1[i] == s2[i] == '1':
			ans += '1'
		else:
			ans += '0'
	res = 0
	for i in range(len(ans)):
		if ans[i] == '1':
			res += 2 ** i
	print((a ^ res) + (b ^ res))


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(A, B) = [int(x) for x in input().split()]
		C = A & B
		print((A ^ C) + (B ^ C))
main()


t = int(input())
for i in range(t):
	data = input().split(' ')
	(a, b) = tuple(map(int, data))
	x = a & b
	ans = (a ^ x) + (b ^ x)
	print(ans)


from sys import stdin, stdout
from math import gcd
input = stdin.readline
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


def get_data_a():
	n = int(input())
	digits = []
	for i in range(n):
		digits.append([int(num) for num in input().split()])
	return digits

def make_calc(data):
	x = []
	a = data[0]
	b = data[1]
	a_b = [int(i) for i in str(bin(a))[2:]]
	b_b = [int(j) for j in str(bin(b))[2:]]
	if len(a_b) > len(b_b):
		while len(a_b) > len(b_b):
			b_b.insert(0, 0)
	elif len(a_b) < len(b_b):
		while len(a_b) < len(b_b):
			a_b.insert(0, 0)
	for (i, j) in zip(a_b, b_b):
		if i and j == 1:
			x.append(1)
		else:
			x.append(0)
	x_b = bin(int(''.join(map(str, x)), 2))
	x_d = int(x_b, base=2)
	result = (a ^ x_d) + (b ^ x_d)
	return result
data = get_data_a()
for set in data:
	print(make_calc(set))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	xor = 0
	for i in range(max(len(bin(a)), len(bin(b)))):
		if a // 2 ** i % 2 == b // 2 ** i % 2 == 1:
			xor += 2 ** i
	print((a ^ xor) + (b ^ xor))


for t in range(int(input())):
	(n, m) = map(int, input().split())
	c = n & m
	k = (n ^ c) + (m ^ c)
	print(k)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	n = a & b
	print((a ^ n) + (b ^ n))


def main():
	n = int(input())
	l = []
	for _ in range(n):
		(x, y) = input().split()
		(x, y) = (int(x), int(y))
		l.append((x, y))
	for e in l:
		print(e[0] ^ e[1])
main()


t = int(input())
for _ in range(t):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	print((a | b) - (a & b))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	if a > b:
		(a, b) = (b, a)
	ba = list(format(a, 'b'))
	bb = list(format(b, 'b'))
	n = len(bb)
	ba.reverse()
	ba += ['0'] * (len(bb) - len(ba))
	bb.reverse()
	ans = 0
	for i in range(n):
		if ba[i] != bb[i]:
			ans += 2 ** i
	print(ans)


import sys, math
import io, os
from bisect import bisect_left as bl, bisect_right as br, insort
from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
INF = float('inf')
mod = 10 ** 9 + 7
for t in range(int(data())):
	(a, b) = mdata()
	out(a ^ b)


import math

class Solution:

	@staticmethod
	def findXORWise(num1, num2):
		minsum = num1 ^ num2
		return minsum
num = int(input())
while num:
	(num1, num2) = list(map(int, input().split()))
	k = Solution.findXORWise(num1, num2)
	print(k)
	num -= 1


def read_ints():
	return map(int, input().split())
for _ in range(int(input())):
	(a, b) = read_ints()
	x = a & b
	print((a ^ x) + (b ^ x))


while True:
	try:
		t = eval(input())
		for i in range(t):
			(a, b) = map(int, input().split())
			print(a ^ b)
	except:
		break


import os
import sys
from math import *
from collections import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	(a, b) = value()
	print(a ^ b)


from sys import stdout as o
for i in range(int(input())):
	(a, b) = map(int, input().split())
	o.write(str(a ^ b) + '\n')


def maxAndXor(arr, n):
	ans = float('inf')
	arr.sort()
	for i in range(n - 1):
		ans = min(ans, arr[i] ^ arr[i + 1])
	return ans
for _ in range(int(input())):
	arr = list(map(int, input().split()))
	N = len(arr)
	print(maxAndXor(arr, N))


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	(a, b) = map(int, input().split())
	if a == b:
		print(0)
		continue
	k = 0
	for i in range(34):
		k = k << i | 1 if a << i == b << i else k << i | 0
	print(a ^ k + b ^ k)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	c = a & b
	d = a ^ c
	e = b ^ c
	print(d + e)


t = int(input())
for _ in range(t):
	lst = list(map(int, input().split()))
	print(lst[0] ^ lst[1])


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().strip().split())
	x = min(a, b)
	y = max(a, b)
	print(x ^ y)


t = int(input())
array = list()
for j in range(t):
	array.append(list(map(int, input().split())))
for j in range(t):
	print(array[j][0] ^ array[j][1])


def solve(a: int, b: int) -> int:
	return (a | b) - (a & b)
assert solve(6, 12) == 10
assert solve(4, 9) == 13
assert solve(59, 832) == 891
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(solve(a, b))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	j = 0
	x = 0
	A = a
	B = b
	x = A & B
	print((a ^ x) + (b ^ x))


import sys
import math
inp = sys.stdin.readline
out = sys.stdout.write

def ii():
	return int(inp())

def mi():
	return map(int, inp().strip().split())

def li():
	return list(map(int, inp().strip().split()))
for _ in range(ii()):
	(a, b) = mi()
	m = min(a, b)
	print((a ^ m) + (b ^ m))


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
for _ in range(ii1()):
	(a, b) = iia()
	print(a ^ b)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = min(a, b)
	ans = (x ^ a) + (x ^ b)
	print(ans)


def binary(n):
	s = ''
	while n > 0:
		s = str(n % 2) + s
		n = n // 2
	return s
for w in range(int(input())):
	(a, b) = map(int, input().split())
	s = binary(a)
	t = binary(b)
	(r, k) = (0, 0)
	if len(s) > len(t):
		t = '0' * (len(s) - len(t)) + t
	if len(t) > len(s):
		s = '0' * (len(t) - len(s)) + s
	m = len(s)
	while r < m:
		if int(s[m - 1 - r]) != int(t[m - 1 - r]):
			k = k + pow(2, r)
		r = r + 1
	print(k)


import math
for _ in range(int(input())):
	array = [int(x) for x in input().split()]
	a = array[0]
	b = array[1]
	print(a ^ b)


T = int(input())
for t in range(T):
	(A, B) = [int(_) for _ in input().split()]
	(ia, ib) = (A, B)
	A = format(A, '#040b')
	B = format(B, '#040b')
	X = []
	for i in range(2, len(A)):
		if A[i] == '1':
			if B[i] == '1':
				X.append('1')
			else:
				X.append('0')
		elif B[i] == '1':
			X.append('0')
		else:
			X.append('0')
	X = int(''.join(X), 2)
	print((ia ^ X) + (ib ^ X))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	for i in range(32):
		if a >> i & 1:
			if b >> i & 1:
				pass
			else:
				x += 1 << i
		elif b >> i & 1:
			x += 1 << i
		else:
			pass
	print(x)


from math import *
from operator import xor
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	print(xor(a, b))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(a, b) = list(map(int, stdin.readline().split()))
	print(a ^ b)


test_cases = int(input())
while test_cases != 0:
	test_cases = test_cases - 1
	(x, y) = map(int, input().split())
	mask = x & y
	print((x ^ mask) + (y ^ mask))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = list(bin(a))
	y = list(bin(b))
	x = x[2:]
	y = y[2:]
	xl = len(x)
	yl = len(y)
	if xl > yl:
		for i in range(xl - yl):
			y.insert(0, '0')
	else:
		for i in range(yl - xl):
			x.insert(0, '0')
	bn = []
	for i in range(len(x)):
		if x[i] == y[i]:
			bn.append(x[i])
		else:
			bn.append('0')
	bn = ''.join(bn)
	k = int(bn, 2)
	a1 = a ^ k
	a2 = b ^ k
	print(a1 + a2)


for __ in range(int(input())):
	(n, m) = map(int, input().split())
	print(n ^ m)


t = int(input())
for f in range(t):
	(a, b) = map(int, input().split())
	print(a ^ b)


for i in range(int(input())):
	(n, m) = list(map(int, input().split()))
	x = n | m
	print((n ^ x) + (m ^ x))


t = eval(input())
for i in range(t):
	number = input()
	number = number.split(' ')
	(a, b) = (eval(number[0]), eval(number[1]))
	m = a ^ b
	print(m)


num = int(input())
while num != 0:
	num -= 1
	(n1, n2) = map(int, input().split(' '))
	n3 = n1 & n2
	ans = (n1 ^ n3) + (n2 ^ n3)
	print(ans)


for _ in range(int(input())):
	(a, b) = input().split()
	(a, b) = (int(a), int(b))
	c = a & b
	print((a ^ c) + (b ^ c))


import sys
input = lambda : sys.stdin.readline().rstrip()
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	for i in range(50):
		ans += ((a >> i & 1) + (b >> i & 1)) % 2 * 2 ** i
	print(ans)


def solve(A, B):
	j = 0
	x = 0
	while A or B:
		if A & 1 and B & 1:
			x += 1 << j
		A >>= 1
		B >>= 1
		j += 1
	return x
t = int(input())
for i in range(t):
	_ = [int(i) for i in input().split()]
	(a, b) = (_[0], _[1])
	x = solve(a, b)
	print((a ^ x) + (b ^ x))


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		yield (a ^ b)
t = int(input())
ans = gift()
print(*ans, sep='\n')


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, sqrt
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from bisect import *
from functools import reduce
from operator import mul
star = lambda x: print(' '.join(map(str, x)))
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
INF = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
import sys
from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def inp():
	return int(stdin.readline())

def inlt():
	return list(map(int, stdin.readline().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, stdin.readline().split())

def pr(n):
	return stdout.write(str(n) + '\n')

def solve():
	(a, b) = invr()
	x = a & b
	print((a ^ x) + (b ^ x))
t = 1
t = inp()
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	res = 0
	x = 1
	while a > 0 or b > 0:
		if a % 2 != b % 2:
			res += x
		a //= 2
		b //= 2
		x *= 2
	print(res)


for _ in range(int(input())):
	(a, b) = sorted([int(x) for x in input().split()])
	(c, d) = (list(bin(a)[2:]), list(bin(b)[2:]))
	tobeprinted = []
	for i in range(1, len(c) + 1):
		if c[-i] == d[-i]:
			tobeprinted.append(c[-i])
		else:
			tobeprinted.append('0')
	additive = int('0b' + ''.join(tobeprinted[::-1]), 2)
	print((a ^ additive) + (b ^ additive))


import sys
LI = lambda : list(map(int, sys.stdin.readline().strip('\n').split()))
MI = lambda : map(int, sys.stdin.readline().strip('\n').split())
SI = lambda : sys.stdin.readline().strip('\n')
II = lambda : int(sys.stdin.readline().strip('\n'))
res = []
for _ in range(II()):
	(a, b) = MI()
	res.append(a ^ b)
print(*res, sep='\n')


t = int(input())
while t:
	t -= 1
	(a, b) = map(int, input().split())
	cur = 0
	ans = 0
	while cur < 90:
		x = a & 1 << cur
		y = b & 1 << cur
		if x != y:
			ans += max(x, y)
		cur += 1
	print(ans)


try:
	t = int(input())
	while t:
		(x, y) = map(int, input().split())
		print(x ^ y)
		t -= 1
except:
	pass


t = int(input())
while t:
	(a, b) = [int(i) for i in input().split(' ')]
	m = 100000000000007
	x = a | b
	print((a ^ x) + (b ^ x))
	t -= 1


test = int(input())
i = 0
while i < test:
	z = input()
	a = list(map(int, z.split(' ')))
	print(a[0] ^ a[1])
	i += 1


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 6 + 6
for _ in range(I()):
	(a, b) = R()
	print(a ^ b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = a & b
	res = (a ^ x) + (b ^ x)
	print(res)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = bin(a)[2:]
	b = bin(b)[2:]
	l = max(len(a), len(b))
	a = a.zfill(l)
	b = b.zfill(l)
	ans = 0
	for (i, (q, w)) in enumerate(zip(a, b)):
		j = l - 1 - i
		if q != w:
			ans += 1 << j
	print(ans)


for i in range(int(input())):
	(a, b) = tuple(map(int, input().split()))
	print(a ^ b)


t = int(input())
for k in range(t):
	(a, b) = map(int, input().split(' '))
	print(a ^ b)


t = int(input())
for i in range(t):
	nums = input().split()
	a = int(nums[0])
	b = int(nums[1])
	print(a ^ b)


(z, zz) = (input, lambda : list(map(int, z().split())))
fast = lambda : stdin.readline().strip()
zzz = lambda : [int(i) for i in fast().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = 1
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(a, b) = szz()
	t = a ^ b
	print(t)


def convert(n):
	binx = bin(n).replace('0b', '')
	y = len(binx)
	return binx
for tc in range(int(input())):
	line = input().split()
	(n1, n2) = (int(line[0]), int(line[1]))
	bin1 = convert(n1)
	bin2 = convert(n2)
	if len(bin1) > len(bin2):
		bin2 = '0' * (len(bin1) - len(bin2)) + bin2
	elif len(bin2) > len(bin1):
		bin1 = '0' * (len(bin2) - len(bin1)) + bin1
	bin3 = ''
	for i in range(len(bin1)):
		if bin1[i] == '0' and bin2[i] == '0':
			bin3 += '0'
		elif bin1[i] == '1' and bin2[i] == '0':
			bin3 += '1'
		elif bin1[i] == '1' and bin2[i] == '1':
			bin3 += '1'
		elif bin1[i] == '0' and bin2[i] == '1':
			bin3 += '1'
	c = int(bin3, 2)
	a = n1 ^ c
	b = n2 ^ c
	print(a + b)


t = int(input())
while t:
	t = t - 1
	(a, b) = map(int, input().split())
	print(min((a ^ a) + (a ^ b), (a ^ b) + (b ^ b)))


for _ in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	p = bin(a)[2:]
	q = bin(b)[2:]
	l = max(len(p), len(q))
	p = '0' * (l - len(p)) + p
	q = '0' * (l - len(q)) + q
	ans = ''
	for i in range(l):
		if p[i] == q[i]:
			ans = ans + p[i]
		else:
			ans = ans + '0'
	ans = int(ans, 2)
	print((a ^ ans) + (b ^ ans))


def rl():
	return list(map(int, input().split()))

def arp(arr):
	return ' '.join([str(i) for i in arr])
from collections import deque, Counter
from math import ceil, sqrt, log2, log, floor
for _ in range(int(input())):
	(n, m) = rl()
	print(n ^ m)


for __ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	print(a ^ b)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from collections import Counter
from bisect import bisect_left
import sys
from queue import PriorityQueue
import operator as op
from functools import reduce
mod = 1000000007

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())

def printIn(ob):
	return stdout.write(str(ob) + '\n')

def powerLL(n, p):
	result = 1
	while p:
		if p & 1:
			result = result * n % mod
		p = int(p / 2)
		n = n * n % mod
	return result

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def isPrime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def myCode():
	(a, b) = In()
	print(a ^ b)

def main():
	for t in range(I()):
		myCode()
main()


def hi(a, b):
	y = a & b
	return (a ^ y) + (b ^ y)
t = int(input())
b = []
for i in range(t):
	(p, q) = map(int, input().split(' '))
	b.append(hi(p, q))
for i in range(len(b)):
	print(b[i])


from sys import stdin
_input = stdin.readline
(_range, _int) = (range, int)

def solution():
	for _ in _range(_int(_input())):
		(a, b) = [_int(i) for i in _input().split()]
		ans = 0
		r = 0
		while a > 0 or b > 0:
			if a == 0 and b % 2 == 1 or (b == 0 and a % 2 == 1):
				ans += 2 ** r
			elif a % 2 == 0 and b % 2 == 0 or (a % 2 == 1 and b % 2 == 1):
				pass
			else:
				ans += 2 ** r
			r += 1
			a //= 2
			b //= 2
		print(ans)
solution()


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	(a, b) = invr()
	x = a & b
	ans = (a ^ x) + (b ^ x)
	print(ans)


for _ in range(0, int(input()), 1):
	(a, b) = map(int, input().split())
	temp = a & b
	res = (a ^ temp) + (b ^ temp)
	print(res)


import math

def dtb(n):
	return bin(n).replace('0b', '')

def btd(n):
	return int(n, 2)
t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	x = a | b
	print((a ^ x) + (b ^ x))


for _ in range(int(input())):
	k = 0
	(a, b) = map(int, input().split())
	a = '0' * 50 + str(bin(a))[2:]
	b = '0' * 50 + str(bin(b))[2:]
	for i in range(1, 51):
		if int(a[len(a) - i]) + int(b[len(b) - i]) == 1:
			k += 2 ** i
	print(k // 2)


t = int(input())
while t > 0:
	t -= 1
	(a, b) = [int(x) for x in input().split()]
	s1 = bin(a)[2:]
	s2 = bin(b)[2:]
	l1 = len(s1)
	l2 = len(s2)
	if l1 > l2:
		s2 = '0' * (l1 - l2) + s2
	else:
		s1 = '0' * (l2 - l1) + s1
	ans = 0
	for i in range(len(s1)):
		if s1[i] == s2[i]:
			pass
		else:
			ans += 2 ** (len(s1) - 1 - i)
	print(ans)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	step = 1
	while step <= a or step <= b:
		step *= 2
	step <= 2
	answer = 0
	while step > 0:
		if step > a and step <= b or (step <= a and step > b):
			answer += step
		if step <= a:
			a -= step
		if step <= b:
			b -= step
		step //= 2
	print(answer)


t = int(input())
ans = []
for iters in range(t):
	s = input()
	arr = s.split()
	a = int(arr[0])
	b = int(arr[1])
	ans.append(a ^ b)
for i in ans:
	print(i)


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	(a, b) = map(int, stdin.readline().split())
	c = a & b
	ans = (a ^ c) + (b ^ c)
	print(ans)


s = int(input())
for x in range(s):
	n = list(map(int, input().split()))
	print(n[0] ^ n[1])


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	A = 10
	n = random.randint(1, N)
	a = [random.randint(1, A) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
ans = 0
for _ in range(I()):
	ans = 0
	(a, b) = LI()
	for i in range(32):
		x = a >> i & 1
		y = b >> i & 1
		if x != y:
			ans += 1 << i
	print(ans)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = bin(a)[2:].zfill(32)
	b = bin(b)[2:].zfill(32)
	res = ''
	for i in range(32):
		x = int(a[i]) + int(b[i])
		if x == 1:
			res += '1'
		else:
			res += '0'
	print(int(res, 2))


for test_var in range(int(input())):
	(a, b) = map(int, input().split())
	print(a ^ b)


def findBits(x, y):
	return (x | y) - (x & y)
n = int(input())
for i in range(0, n):
	(x, y) = map(int, input().split(' '))
	if __name__ == '__main__':
		print(findBits(x, y))


import sys
from math import log2

def main(stream=sys.stdin):
	n = int(stream.readline())
	for _ in range(n):
		(a, b) = [int(tok) for tok in stream.readline().split()]
		c = max(a, b)
		pmax = int(log2(c))
		res = 0
		for p in range(pmax + 1):
			ra = a % 2
			rb = b % 2
			if ra * rb != 1:
				res += 2 ** p * (ra + rb)
			a = a >> 1
			b = b >> 1
		print(res)
main()


t = int(input())

def process():
	(a, b) = map(int, input().split())
	print(b ^ a)
for it in range(t):
	process()


for w in range(int(input())):
	(a, b) = tuple(map(int, input().split()))
	l = [0] * 32
	ans = 0
	a1 = bin(a).replace('0b', '')[::-1]
	b1 = bin(b).replace('0b', '')[::-1]
	for i in range(min(len(a1), len(b1))):
		if a1[i] == b1[i]:
			continue
		else:
			ans += pow(2, i)
	if len(a1) > len(b1):
		c1 = a1
	else:
		c1 = b1
	for i in range(min(len(a1), len(b1)), len(c1)):
		if c1[i] == '1':
			ans += pow(2, i)
	print(ans)


import sys

def input():
	return sys.stdin.readline().rstrip()
t = int(input())
for i in range(t):
	[a, b] = list(map(int, input().split()))
	print(a ^ b)


for tt in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	for i in range(31):
		if a & 1 << i or b & 1 << i:
			x += 2 ** i
	print((a ^ x) + (b ^ x))


n = int(input())
for i in range(n):
	ch = input()
	L = []
	l = [int(i) for i in ch.split()]
	print(l[0] ^ l[1])


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		(a, b) = In()
		t = a & b
		print((a ^ t) + (b ^ t))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b) = sp()
	answer = 0
	for i in range(32):
		(p1, p2) = (1 << i & a, 1 << i & b)
		if p1 != p2:
			answer += 1 << i
	out(answer)


cases = int(input())
resultados = list()
for n in range(cases):
	grande = resultado = a = b = 0
	numeros = input()
	numeros = numeros.split(' ')
	a = int(numeros[0])
	b = int(numeros[1])
	if a >= b:
		grande = a
		resultado = b ^ a
	else:
		grande = b
		resultado = a ^ b
	resultados.append(resultado)
for n in range(len(resultados)):
	print(resultados[n])


from sys import stdin

def main():
	input = lambda : stdin.readline()[:-1]
	T = int(input())
	for _ in [0] * T:
		(A, B) = map(int, input().split())
		print((A ^ A) + (B ^ A))
main()


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import *
getcontext().prec = 25
from itertools import permutations
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	print(a ^ b)


import sys
import math
import itertools

def get_line():
	return list(map(int, sys.stdin.readline().strip().split()))

def in1():
	return int(input())
for _ in range(in1()):
	(a, b) = get_line()
	t = a ^ b
	print(t)


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	print(n ^ m)


tc = int(input())
for i in range(tc):
	(x, y) = list(map(int, input().split()))
	print(x ^ y)


for i in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	print(x ^ y)


import sys

def solve(first: int, second: int) -> int:
	time = 0
	estimate_result = 0
	while first or second:
		if first & 1 and second & 1:
			estimate_result += 1 << time
		first >>= 1
		second >>= 1
		time += 1
	return estimate_result
for (count, line) in enumerate(sys.stdin):
	if count == 0:
		continue
	(x, y) = [int(i) for i in line.split(' ')]
	result = solve(x, y)
	print((x ^ result) + (y ^ result))


testcases = int(input())
for i in range(testcases):
	(a, b) = [int(x) for x in input().split()]
	result = 0
	if a == b:
		print(0)
	else:
		binaryA = bin(a)[2:]
		binaryB = bin(b)[2:]
		if a > b or len(binaryA) > len(binaryB):
			extra = len(binaryA) - len(binaryB)
			binaryB = '0' * extra + binaryB
		else:
			extra = len(binaryB) - len(binaryA)
			binaryA = '0' * extra + binaryA
		j = len(binaryB) - 1
		for i in range(len(binaryA)):
			if binaryA[i] != binaryB[i]:
				result += 2 ** j
			j -= 1
		print(result)


def xor(l):
	return l[0] ^ l[1]
for _ in range(int(input())):
	print(xor(list(map(int, input().split()))))


r = int(input())
for t in range(r):
	(a, b) = [int(x) for x in input().split()]
	print((a ^ a & b) + (b ^ a & b))


t = int(input())
for _ in range(t):
	[a, b] = [int(i) for i in input().split()]
	(org_a, org_b) = (a, b)
	res = 0
	exp = 1
	while a > 0 and b > 0:
		if a % 2 == 1 and b % 2 == 1:
			res += exp
		a = a // 2
		b = b // 2
		exp *= 2
	print((org_a ^ res) + (org_b ^ res))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	if y == 0:
		return 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt
from decimal import Decimal

def solve():
	(a, b) = read()
	print(a ^ b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


t = int(input())
for i in range(0, t):
	(a, b) = [int(x) for x in input().split(' ')]
	print(a ^ b)


for t in range(int(input())):
	(a, b) = map(int, input().split())
	ans = 0
	pow = 1
	for i in range(32):
		if a & pow == b & pow:
			ans += 0
			pow *= 2
		else:
			ans += pow
			pow *= 2
	print(ans)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	min1 = 100000000
	if a > b:
		(a, b) = (b, a)
	x = a & b
	print((a ^ x) + (b ^ x))


import sys, os, io
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
for tc in range(1, 1 + int(I())):
	(a, b) = map(int, I().split())
	(a, b) = (min(a, b), max(a, b))
	c = a & b
	print((a ^ c) + (b ^ c))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, sqrt, factorial, cos, tan, sin, radians, floor
import bisect
from decimal import *
getcontext().prec = 8
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def fn(n):
	c = 0
	while n % 2 == 0:
		c += 1
		n //= 2
	return c

def main():
	for _ in range(ii()):
		(a, b) = mi()
		print(a ^ b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


t = int(input())
for i in range(t):
	list1 = input().split()
	for i in range(2):
		list1[i] = int(list1[i])
	a = list1[0]
	b = list1[1]
	print(a ^ b)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	x = max(a, b)
	y = min(a, b)
	(p, ans) = (1, 0)
	while x > 0:
		l1 = x & 1
		l2 = y & 1
		if l1 == 0 and l2 == 1:
			ans += p
		elif l1 == 1 and l2 == 0:
			ans += p
		p = p * 2
		x = x >> 1
		y = y >> 1
	print(ans)


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = a and b
	answer = (a ^ x) + (b ^ x)
	print(answer)


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
imput = input
primt = print
for _ in range(int(imput())):
	(a, b) = map(int, imput().split())
	first = str(bin(a))[2:]
	second = str(bin(b))[2:]
	if len(second) > len(first):
		(first, second) = (second, first)
	second = '0' * (len(first) - len(second)) + second
	ans = ['0'] * len(first)
	for i in range(len(first)):
		if first[i] == '1' and second[i] == '1':
			ans[i] = '1'
	x = int(''.join(ans), 2)
	print((a ^ x) + (b ^ x))


def solution():
	(a, b) = map(int, input().split())
	ans = a ^ b
	print(ans)

def main():
	testcase = int(input())
	for i in range(testcase):
		solution()
	return
main()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	x = 0
	for i in range(32, -1, -1):
		sub1 = a & 1 << i
		sub2 = b & 1 << i
		if sub1 and sub2:
			x = x | 1 << i
	ans = (a ^ x) + (b ^ x)
	print(ans)


ncases = int(input())
for tcase in range(ncases):
	(a, b) = map(int, input().split(' '))
	sum = 0
	shifts = 0
	while not a == 0 or not b == 0:
		if a & 1 == b & 1:
			temp = 0
		else:
			temp = 1
		temp = temp << shifts
		sum += temp
		shifts += 1
		a = a >> 1
		b = b >> 1
	print(sum)


def myXOR(x, y):
	return x & ~y | ~x & y
n = int(input())
for i in range(0, n):
	(a, b) = map(int, input().split())
	print(myXOR(a, b))


from collections import deque
from heapq import heapify, heappush, heappop
n = int(input())
for x in range(n):
	(a, b) = map(int, input().split())
	if a + b == 1:
		print(0)
	a = bin(a)[2:]
	b = bin(b)[2:]
	l = max(len(a), len(b))
	a = a.zfill(l)
	b = b.zfill(l)
	ar = [0] * l
	for y in range(l):
		if a[y] != b[y]:
			ar[y] = 1
	res = ''.join(map(str, ar))
	res = int(res, 2)
	print(res)
print()


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ans = 0
	for i in range(40):
		if a & 1 << i >= 1 and b & 1 << i >= 1:
			ans += 2 ** i
	print((a ^ ans) + (b ^ ans))


test = int(input())
for _ in range(test):
	(a, b) = map(int, input().split())
	A = a
	B = b
	i = 0
	x = 0
	while a or b:
		if a & 1 and b & 1:
			x += 1 << i
		a >>= 1
		b >>= 1
		i += 1
	print((A ^ x) + (B ^ x))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split(' '))
	(a, b) = (bin(x)[2:], bin(y)[2:])
	v = 0
	if len(a) > len(b):
		b = '0' * (len(a) - len(b)) + b
	elif len(a) < len(b):
		a = '0' * (len(b) - len(a)) + a
	n = len(a)
	for i in range(len(a)):
		if a[i] != b[i]:
			v += 2 ** (n - i - 1)
	print(v)


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	i = 0
	minus = 0
	while i <= 30:
		c = 1 << i
		if a & c and b & c:
			minus += c << 1
		i += 1
	print(a + b - minus)
	t -= 1


print('\n'.join([(lambda a, b: str(a ^ b))(*map(int, input().split())) for i in range(int(input()))]))


import math
t1 = int(input())
for _ in range(t1):
	(a, b) = map(int, input().split())
	b1 = []
	t = ''
	print(a ^ b)


from collections import Counter, OrderedDict
from itertools import permutations as perm
from sys import setrecursionlimit
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import threading
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(a, b) = gil()
	c = min(a, b)
	print((a ^ c) + (b ^ c))


def XORwice(a, b):
	(i, x) = (0, 0)
	while a or b:
		if a & 1 and b & 1:
			x += 1 << i
		a >>= 1
		b >>= 1
		i += 1
	return x
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	ANS = XORwice(a, b)
	ans = (ANS ^ a) + (ANS ^ b)
	print(ans)


def main():
	for i in range(int(input())):
		(a, b) = map(int, input().split())
		print(a ^ b)
main()


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	res = 0
	for i in range(31):
		if a >> i & 1 == b >> i & 1:
			continue
		res += 1 << i
	print(res)


n = int(input())
while n > 0:
	(a, b) = input().split(' ')
	a = int(a)
	b = int(b)
	c = a or b
	ans = (a ^ c) + (b ^ c)
	print(ans)
	n -= 1


t = int(input())
while t:
	(a, b) = map(int, input().split())
	c = max(a, b)
	prev = (a ^ c) + (b ^ c)
	while c:
		if (a ^ c) + (b ^ c) < prev:
			prev = (a ^ c) + (b ^ c)
		c = c >> 1
	print(prev)
	t = t - 1


t = int(input(''))
for _ in range(t):
	[a, b] = list(map(int, input().split()))
	x = a
	y = b
	if a == b:
		print(0)
		continue
	a = bin(a)
	b = bin(b)
	a = a[2:]
	b = b[2:]
	na = len(a)
	nb = len(b)
	if len(a) > len(b):
		b = '0' * (len(a) - len(b)) + b
	else:
		a = '0' * (nb - na) + a
	sol = []
	for i in range(max(na, nb)):
		if a[i] == b[i]:
			if a[i] == '1':
				sol.append(1)
			else:
				sol.append(0)
		else:
			sol.append(0)
	n = max(na, nb)
	sol.reverse()
	ans = 0
	for i in range(n):
		ans += 2 ** i * sol[i]
	print((ans ^ x) + (ans ^ y))


from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	(a, b) = M()
	print(a ^ b)


from collections import *
from itertools import *
from bisect import *

def inp():
	return int(input())

def arrinp():
	return [int(x) for x in input().split()]

def main():
	t = inp()
	for _ in range(t):
		(a, b) = arrinp()
		x = a & b
		ans = (a ^ x) + (b ^ x)
		print(ans)
main()


def readis():
	return map(int, input().strip().split())
T = int(input())
while T:
	T -= 1
	(a, b) = readis()
	x = a if a <= b else b
	print((a ^ x) + (b ^ x))


n = int(input())
for j in range(n):
	(a, b) = map(int, input().split())
	print(a ^ b)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(a, b) = li()
	ans = 0
	for i in range(32):
		if a >> i & 1 == b >> i & 1:
			ans += 0
		else:
			ans += 1 << i
	print(ans)


anss = []
t = int(input())
for _ in range(t):
	inp = list(map(int, input().split()))
	a = inp[0]
	b = inp[1]
	q = a & b
	anss.append((a ^ q) + (b ^ q))
for i in anss:
	print(i)


import sys
for i in range(int(sys.stdin.readline())):
	(a, b) = map(int, sys.stdin.readline().split())
	x = []
	x.append((a ^ min(a, b)) + (b ^ min(a, b)))
	print(min(x))