For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as:  
X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus  denotes the [bitwise XOR] operation. 

Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the values of A, B, and C.

Note: 
You need to print the integers A, B, and C in ascending order.
It is guaranteed in the input that a unique answer exists.

------ Input Format ------ 

- The first line contains one integer T — the number of test cases. Then T test cases follow.
- Each test case consists of one line which contains 2 integers X and Y.

------ Output Format ------ 

- For each test case, print 3 integers —  A , B,  and C in ascending order where (1 < A,B,C < 2^{30}).

------ Constraints ------ 

$1 ≤ T ≤ 10^{5}$
$1 ≤ X, Y< 2^{30}$

----- Sample Input 1 ------ 
2
1 6
9 15
----- Sample Output 1 ------ 
2 3 5
2 11 13
----- explanation 1 ------ 
Test Case $1$: The answer is $A=2, B=3, C=5$. Thus, $X=2\oplus 3 = 1, Y = 3\oplus 5 = 6, Z = 2\oplus 5 = 7$. Note that $X$ and $Y$ are same as mentioned in input and the values $X$ as well as $Z$ are odd.

Test Case $2$: The answer is $A=11, B=2, C=13$. Thus, $X=11\oplus 2 = 9, Y = 2\oplus 13 = 15, Z = 11\oplus 13 = 6$. Note that $X$ and $Y$ are same as mentioned in input and the values $X$ as well as $Y$ are odd. 
Thus, the values of $A, B,$ and $C$ in ascending order are $2, 11,$ and $13$.

Source: codechef | Difficulty: MEDIUM
Tags: Bit manipulation

Mathematics


Solutions:
i = int(input())
listk = []
for _ in range(i):
	kk2 = input().split()
	kk = []
	tot = []
	for ele in kk2:
		kk.append(int(ele))
	if (kk[0] ^ kk[1]) % 2 == 1:
		tot.append(2)
		k0 = ''
		if kk[0] % 2 == 1:
			tot.append(kk[0] ^ 2)
			tot.append(kk[0] ^ 2 ^ kk[1])
		if kk[0] % 2 == 0:
			tot.append(kk[1] ^ 2)
			tot.append(kk[0] ^ 2 ^ kk[1])
	if (kk[0] ^ kk[1]) % 2 == 0:
		tot.append(2)
		tot.append(2 ^ kk[0])
		tot.append(2 ^ kk[1])
	tot.sort()
	ans = ''
	for ele in tot:
		if ele == tot[-1]:
			ans = ans + str(ele)
		else:
			ans = ans + str(ele) + ' '
	listk.append(ans)
for ele in listk:
	print(ele)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	a = 2
	if x % 2 == 0:
		print(*sorted([2, y ^ 2, x ^ y ^ 2]))
	elif y % 2 == 0:
		print(*sorted([2, x ^ 2, y ^ x ^ 2]))
	else:
		print(*sorted([2, x ^ 2, y ^ 2]))


l = -1
m = -1
n = l + m
for i in range(int(input())):
	(a1, b1) = [int(x) for x in input().split()]
	if a1 % 2 == 0:
		b = 2 ^ b1
		c = b ^ a1
	elif b1 % 2 == 0:
		b = 2 ^ a1
		c = b ^ b1
	else:
		b = 2 ^ a1
		c = 2 ^ b1
	print('%d %d %d' % (2, min(b, c), max(b, c)))


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

def bx(a, b):
	k = '0'
	n = max(len(a), len(b))
	a = a.zfill(n)
	b = b.zfill(n)
	for i in range(n):
		k += str((int(a[i]) + int(b[i])) % 2)
	return k
t = int(input())
for i in range(t):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	if x % 2 == 0 and y % 2 == 1:
		x = bin(x)[2:]
		y = bin(y)[2:]
		c = '10'
		b = bx(y, c)
		a = bx(x, b)
		a = int(a, 2)
		b = int(b, 2)
		c = int(c, 2)
		arr = [a, b, c]
		arr.sort()
		for z in arr:
			print(z, end=' ')
	elif x % 2 == 1 and y % 2 == 1:
		x = bin(x)[2:]
		y = bin(y)[2:]
		b = '10'
		c = bx(y, b)
		a = bx(x, b)
		a = int(a, 2)
		b = int(b, 2)
		c = int(c, 2)
		arr = [a, b, c]
		arr.sort()
		for z in arr:
			print(z, end=' ')
	elif x % 2 == 1 and y % 2 == 0:
		x = bin(x)[2:]
		y = bin(y)[2:]
		a = '10'
		b = bx(x, a)
		c = bx(y, b)
		a = int(a, 2)
		b = int(b, 2)
		c = int(c, 2)
		arr = [a, b, c]
		arr.sort()
		for z in arr:
			print(z, end=' ')
	print()


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	if x % 2 == 0 and y % 2 == 1:
		print(*sorted([2, y ^ 2, x ^ y ^ 2]))
	elif x % 2 == 1 and y % 2 == 0:
		print(*sorted([2, x ^ 2, x ^ y ^ 2]))
	else:
		print(*sorted([2, x ^ 2, y ^ 2]))


tc = int(input().strip())
for t in range(tc):
	(x, y) = map(int, input().split())
	z = x ^ y
	abc = [2]
	if x % 2 == 1:
		abc.append(x ^ 2)
	if y % 2 == 1:
		abc.append(y ^ 2)
	if z % 2 == 1:
		abc.append(z ^ 2)
	abc.sort()
	print(*abc)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	if x % 2 == 0:
		c = 2
		b = y ^ c
		a = z ^ c
	elif y % 2 == 0:
		a = 2
		c = z ^ a
		b = x ^ a
	elif z % 2 == 0:
		b = 2
		c = y ^ b
		a = x ^ b
	print(*sorted([a, b, c]))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x % 2 == 1 and y % 2 == 1:
		a = x ^ 2
		b = 2
		c = y ^ 2
	elif y % 2 == 1:
		a = x ^ y ^ 2
		b = y ^ 2
		c = 2
	else:
		a = 2
		b = x ^ 2
		c = x ^ y ^ 2
	l = sorted([a, b, c])
	print(*l)


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	Z = X ^ Y
	A = 2
	if X % 2 != 0:
		B = 2 ^ X
		if Y % 2 != 0:
			C = 2 ^ Y
		else:
			C = 2 ^ Z
	else:
		B = 2 ^ Y
		C = 2 ^ Z
	print(' '.join(map(str, sorted([A, B, C]))))


for _ in range(int(input())):
	(x, y) = map(int, input().split(' '))
	ans = []
	if x % 2 != 0 and y % 2 != 0:
		b = 2
		c = y ^ b
		a = x ^ b
		ans.append(a)
		ans.append(b)
		ans.append(c)
	elif x % 2 == 0 and y % 2 != 0:
		c = 2
		b = y ^ c
		a = x ^ b
		ans.append(a)
		ans.append(b)
		ans.append(c)
	elif x % 2 == 0 and y % 2 == 0:
		b = 2
		c = y ^ b
		a = x ^ b
		ans.append(a)
		ans.append(b)
		ans.append(c)
	else:
		a = 2
		b = x ^ a
		c = y ^ b
		ans.append(a)
		ans.append(b)
		ans.append(c)
	ans.sort()
	print(' '.join((str(x) for x in ans)))


for _ in range(int(input())):
	lst = [2]
	(x, y) = map(int, input().split())
	if x % 2 != 0:
		ans = 2 ^ x
		lst.append(ans)
	if y % 2 != 0:
		ans = 2 ^ y
		lst.append(ans)
	if x % 2 == 0:
		ans = lst[-1] ^ x
		lst.append(ans)
	if y % 2 == 0:
		ans = lst[-1] ^ y
		lst.append(ans)
	lst.sort()
	print(*lst)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	a = b = c = 0
	if x % 2 == 0:
		c = 2
		b = y ^ c
		a = x ^ b
	elif y % 2 == 0:
		a = 2
		c = z ^ a
		b = y ^ c
	else:
		b = 2
		a = x ^ b
		c = z ^ a
	arr = [a, b, c]
	arr.sort()
	print(*arr)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	l = [x, y, z]
	a = []
	for i in range(3):
		if l[i] & 1 == 1:
			a.append(l[i] ^ 2)
	print('2', str(min(a)), str(max(a)))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	l = [x, y, z]
	for i in range(3):
		if l[i] % 2 != 0:
			l[i] ^= 2
		else:
			l[i] = 2
	print(' '.join((str(x) for x in sorted(l))))


tests = int(input())
for i in range(tests):
	(x, y) = map(int, input().split())
	a = 2
	c = x ^ y ^ 2
	if x & 1 and y & 1:
		b = 2 ^ x
		c = 2 ^ y
	elif x & 1:
		b = 2 ^ x
	else:
		b = 2 ^ y
	total = a + b + c
	minimum = min(a, b, c)
	maximum = max(a, b, c)
	print(minimum, total - minimum - maximum, maximum)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	z = x ^ y
	q = [x, y, z]
	for i in range(3):
		if q[i] % 2 == 0:
			q[i] = 2
		else:
			q[i] ^= 2
	print(*sorted(q))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	a = []
	a.append(2)
	if x & 1 != 0:
		a.append(2 ^ x)
		if y & 1 != 0:
			a.append(2 ^ y)
		else:
			a.append(2 ^ z)
	else:
		a.append(2 ^ y)
		a.append(2 ^ z)
	a.sort()
	print(*a)


def function(X, Y):
	Z = X ^ Y
	if X % 2 == 0:
		C = 2
		B = Y ^ C
		A = X ^ B
		arr = sorted([A, B, C])
		return ' '.join((str(i) for i in arr))
	elif Y % 2 == 0:
		A = 2
		B = X ^ A
		C = Z ^ A
		arr = sorted([A, B, C])
		return ' '.join((str(i) for i in arr))
	else:
		B = 2
		A = X ^ B
		C = Y ^ B
		arr = sorted([A, B, C])
		return ' '.join((str(i) for i in arr))

def main():
	T = int(input())
	for _ in range(T):
		(X, Y) = list(map(int, input().split(' ')))
		val = function(X, Y)
		print(val)
main()


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	l = [2, 2, 2]
	if x & 1:
		l[0] = x ^ 2
	if y & 1:
		l[1] = y ^ 2
	if z & 1:
		l[2] = z ^ 2
	l.sort()
	print(f'{l[0]} {l[1]} {l[2]}')


T = int(input())
for _ in range(T):
	(X, Y) = map(int, input().split())
	Z = X ^ Y
	if X % 2 == 0:
		C = 2
		A = Z ^ 2
		B = Y ^ 2
	elif Y % 2 == 0:
		A = 2
		B = X ^ 2
		C = Z ^ 2
	else:
		B = 2
		A = X ^ 2
		C = Y ^ 2
	print(*sorted([A, B, C]))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	if x % 2 == 1 and y % 2 == 1:
		b = 2
		a = x ^ b
		c = y ^ b
	elif x % 2 == 1 and z % 2 == 1:
		a = 2
		b = x ^ a
		c = z ^ a
	elif y % 2 == 1 and z % 2 == 1:
		c = 2
		b = y ^ c
		a = x ^ b
	ans = sorted([a, b, c])
	print(*ans)


import math

def solve(x, y):
	z = x ^ y
	if x % 2 == 1 and z % 2 == 1:
		a = 2
		b = x ^ 2
		c = z ^ 2
		l = [a, b, c]
	elif x % 2 == 1 and y % 2 == 1:
		b = 2
		a = x ^ b
		c = y ^ b
		l = [a, b, c]
	else:
		c = 2
		a = z ^ 2
		b = y ^ 2
		l = [a, b, c]
	l.sort()
	return l

def isprime(num):
	for i in range(2, int(pow(num, 1 / 2) + 1)):
		if num % i == 0:
			return False
	return True
n = int(input())
results = []
for i in range(0, n):
	(a, b) = map(int, input().split())
	out = solve(a, b)
	results.append(out)
for j in results:
	print(j[0], ' ', j[1], ' ', j[2])


from sys import stdin
for _ in range(int(stdin.readline())):
	(x, y) = map(int, stdin.readline().split())
	z = x ^ y
	arr = [2]
	if x % 2:
		arr.append(x ^ 2)
	if y % 2:
		arr.append(y ^ 2)
	if z % 2:
		arr.append(z ^ 2)
	arr.sort()
	print(*arr)


T = int(input())
for tc in range(T):
	(x, y) = map(int, input().split(' '))
	z = x ^ y
	prime = [2]
	for alphabet in [z, x, y]:
		if alphabet % 2 == 1:
			if alphabet % 4 == 1:
				prime.append(alphabet + 2)
			else:
				prime.append(alphabet - 2)
	prime.sort()
	print(*prime)


def solve():
	(X, Y) = map(int, input().split())
	Z = X ^ Y
	ans = [2, 2, 2]
	if X & 1:
		ans[0] = X ^ 2
	if Y & 1:
		ans[1] = Y ^ 2
	if Z & 1:
		ans[2] = Z ^ 2
	ans.sort()
	print(ans[0], end=' ')
	print(ans[1], end=' ')
	print(ans[2])
t = int(input())
while t > 0:
	solve()
	t = t - 1


T = int(input())
vector = lambda x, t: [t(num) for num in x.split()]
for _ in range(T):
	(x, y) = vector(input(), int)
	z = x ^ y
	if x & 1 and y & 1:
		b = 2
		a = 2 ^ x
		c = z ^ a
		ans = sorted([a, b, c])
		print(*ans)
	elif y & 1 and z & 1:
		c = 2
		a = z ^ c
		b = y ^ c
		ans = sorted([a, b, c])
		print(*ans)
	elif x & 1 and z & 1:
		a = 2
		c = z ^ a
		b = y ^ c
		ans = sorted([a, b, c])
		print(*ans)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	start = [x, y, z]
	if x % 2 == 0:
		c = 2
		b = y ^ 2
		a = z ^ 2
	elif y % 2 == 0:
		a = 2
		b = x ^ 2
		c = z ^ 2
	elif z % 2 == 0:
		b = 2
		a = x ^ 2
		c = y ^ 2
	ans = [a, b, c]
	ans = sorted(ans)
	print(' '.join([str(i) for i in ans]))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	(x1, y1) = (x, y)
	if x % 2 == 1:
		x1 = x1 ^ 2
	if y % 2 == 1:
		y1 = y1 ^ 2
	if x % 2 == 0:
		x1 = y1 ^ x
	if y % 2 == 0:
		y1 = x1 ^ y
	k = sorted([2, x1, y1])
	print(k[0], k[1], k[2], sep=' ')


for h in range(int(input())):
	(x, y) = map(int, input().split(' '))
	a = 2
	arr = [x, y]
	ar = [2]
	if 2 ^ (2 ^ x) in arr and (2 ^ x) % 2:
		b = 2 ^ x
		ar.append(b)
		if (a ^ (a ^ y) == y or b ^ (a ^ y) == y) and (a ^ y) % 2:
			ar.append(a ^ y)
		if (a ^ (b ^ y) == y or b ^ (b ^ y) == y) and (b ^ y) % 2:
			ar.append(b ^ y)
	elif 2 ^ (2 ^ y) in arr and (2 ^ y) % 2:
		b = 2 ^ y
		ar.append(b)
		if (a ^ (a ^ x) == x or b ^ (a ^ x) == x) and (a ^ x) % 2:
			ar.append(a ^ x)
		if (a ^ (b ^ x) == x or b ^ (b ^ x) == x) and (b ^ x) % 2:
			ar.append(b ^ x)
	ar.sort()
	print(*ar)


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	a = 2
	if x % 2 != 0:
		b = x ^ 2
		if y % 2 != 0:
			c = y ^ 2
		else:
			c = y ^ b
	elif y % 2 != 0:
		b = y ^ 2
		c = x ^ b
	else:
		b = z ^ 2
		c = x ^ b
	ans = [a, b, c]
	ans.sort()
	for v in ans:
		print(v, end=' ')
	print()


for i in range(int(input())):
	(x, y) = map(int, input().split())
	x1 = list(bin(x).replace('0b', ''))
	y1 = list(bin(y).replace('0b', ''))
	if x == 1:
		x1 = ['0'] + x1
	if y == 1:
		y1 = ['0'] + y1
	if x % 2 == 1:
		if x1[len(x1) - 2] == '0':
			x1[len(x1) - 2] = '1'
		else:
			x1[len(x1) - 2] = '0'
		x1 = ''.join(x1)
		x1 = int(x1, 2)
	if y % 2 == 1:
		if y1[len(y1) - 2] == '0':
			y1[len(y1) - 2] = '1'
		else:
			y1[len(y1) - 2] = '0'
		y1 = ''.join(y1)
		y1 = int(y1, 2)
	if x % 2 == 0:
		x1 = y1 ^ x
	if y % 2 == 0:
		y1 = x1 ^ y
	k = sorted([2, x1, y1])
	print(k[0], k[1], k[2], sep=' ')


ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input()

def solve():
	(x, y) = rl()
	z = x ^ y
	ans = [2]
	if x % 2 == 0:
		ans.append(y ^ 2)
		ans.append(z ^ 2)
	elif y % 2 == 0:
		ans.append(x ^ 2)
		ans.append(z ^ 2)
	elif z % 2 == 0:
		ans.append(x ^ 2)
		ans.append(y ^ 2)
	ans.sort()
	return ans

def main():
	for _ in range(ri()):
		print(*solve())
main()


t = int(input())
for i in range(t):
	xy = list(map(int, input().split()))
	x = xy[0]
	y = xy[1]
	if x % 2 == 0 and y % 2 == 1:
		c = 2
		b = y ^ 2
		a = x ^ b
		print(c, min(b, a), max(b, a))
	elif x % 2 == 1 and y % 2 == 0:
		a = 2
		b = x ^ 2
		c = y ^ b
		print(a, min(b, c), max(b, c))
	else:
		b = 2
		a = x ^ 2
		c = y ^ 2
		print(b, min(c, a), max(c, a))


T = int(input())
for cases in range(T):
	(X, Y) = map(int, input().split())
	if X % 2 == 1 and Y % 2 == 1:
		B = 2
		A = X ^ B
		C = Y ^ B
	elif X % 2 == 1:
		A = 2
		B = X ^ A
		C = Y ^ B
	else:
		C = 2
		B = Y ^ C
		A = X ^ B
	print(*sorted([A, B, C]))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	arr = []
	if x % 2 == 0:
		arr = [2, y ^ 2, z ^ 2]
	elif y % 2 == 0:
		arr = [x ^ 2, 2, z ^ 2]
	elif z % 2 == 0:
		arr = [x ^ 2, y ^ 2, 2]
	arr.sort()
	for i in arr:
		print(i, end=' ')
	print()


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	a = [2, 2, 2]
	if x & 1:
		a[0] = x ^ 2
	if y & 1:
		a[1] = y ^ 2
	if z & 1:
		a[2] = z ^ 2
	a.sort()
	for s in a:
		print(s, end=' ')
	print()


from math import sqrt, ceil, floor, gcd, log2
import sys
from sys import stdin, stdout
from collections import Counter, defaultdict, OrderedDict, deque
from itertools import combinations, groupby
from time import time
from heapq import heappop, heappush, heapify
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	(a, b, c) = (0, 0, 0)
	if x % 2 == 0:
		(a, b, c) = (min(y ^ 2, z ^ 2), max(y ^ 2, z ^ 2), 2)
		print(c, a, b)
	elif y % 2 == 0:
		(a, b, c) = (2, min(x ^ 2, z ^ 2), max(x ^ 2, z ^ 2))
		print(a, b, c)
	else:
		(a, b, c) = (min(x ^ 2, y ^ 2), 2, max(x ^ 2, y ^ 2))
		print(b, a, c)


t = int(input())
for _ in range(t):
	(x, y) = [int(x) for x in input().split()]
	res = [2] * 3
	z = x ^ y
	if x & 1:
		res[0] = x ^ 2
	if y & 1:
		res[1] = y ^ 2
	if z & 1:
		res[2] = z ^ 2
	res.sort()
	for val in res:
		print(val, end=' ')
	print()


for i in range(int(input())):
	(x, y) = map(int, input().split())
	l = [2]
	z = x ^ y
	if x % 2 != 0:
		l.append(2 ^ x)
		if y % 2 != 0:
			l.append(2 ^ y)
		else:
			l.append(2 ^ z)
	else:
		l.append(2 ^ y)
		l.append(2 ^ z)
	l.sort()
	print(*l)


t = int(input())
for x in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	a = [2]
	if x % 2 == 0:
		a.append(a[0] ^ y)
		a.append(a[0] ^ z)
	elif y % 2 == 0:
		a.append(a[0] ^ z)
		a.append(a[0] ^ x)
	elif z % 2 == 0:
		a.append(a[0] ^ y)
		a.append(a[0] ^ x)
	a = sorted(a)
	print(str(a[0]) + ' ' + str(a[1]) + ' ' + str(a[2]))


def solution():
	(x, y) = map(int, input().split())
	z = x ^ y
	ans = [2, 2, 2]
	if x & 1:
		ans[0] = x ^ 2
	if y & 1:
		ans[1] = y ^ 2
	if z & 1:
		ans[2] = z ^ 2
	ans.sort()
	return ans
t = int(input())
for test in range(t):
	print(' '.join((str(char) for char in solution())))


def fill():
	bit = []
	for i in range(30):
		bit.append(0)
	return bit

def gen(num, bit, n=1):
	bit[30 - n] = num % 2
	num = num // 2
	if num == 0:
		return bit
	else:
		n += 1
		return gen(num, bit, n)

def xor(bit_m, bit_n):
	bit_p = fill()
	p = 0
	for i in range(30):
		if not bit_m[i] == bit_n[i]:
			bit_p[i] = 1
			p += 2 ** (29 - i)
	return p

def asc(b, c):
	if b > c:
		print('2 ' + str(c) + ' ' + str(b))
	else:
		print('2 ' + str(b) + ' ' + str(c))
a = 2
bit_a = gen(a, fill())
t = int(input())
for i in range(t):
	m = input()
	m = m.split(' ')
	x = int(m[0])
	bit_x = gen(x, fill())
	y = int(m[1])
	bit_y = gen(y, fill())
	if x % 2 == 1 and y % 2 == 0:
		b = xor(bit_x, bit_a)
		bit_b = gen(b, fill())
		c = xor(bit_y, bit_b)
	elif x % 2 == 0 and y % 2 == 1:
		b = xor(bit_y, bit_a)
		bit_b = gen(b, fill())
		c = xor(bit_x, bit_b)
	else:
		b = xor(bit_y, bit_a)
		c = xor(bit_x, bit_a)
	asc(b, c)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	ans = [2]
	if x % 2 == 1:
		ans.append(x ^ 2)
		if y % 2 == 1:
			ans.append(y ^ 2)
		else:
			ans.append(y ^ ans[1])
	else:
		ans.append(y ^ 2)
		ans.append(ans[1] ^ x)
	print(*sorted(ans))


for _ in range(int(input())):
	(X, Y) = [int(x) for x in input().split()]
	ans = [2]
	for x in [X, Y, X ^ Y]:
		if (2 ^ x) % 2:
			ans.append(2 ^ x)
	print(*sorted(ans[:3]))


t = int(input())
for tc in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	l = []
	if x % 2 != 0 and y % 2 == 0:
		l.append(x ^ 2)
		l.append(2)
		l.append(z ^ 2)
	if x % 2 == 0 and y % 2 != 0:
		l.append(y ^ 2)
		l.append(2)
		l.append(z ^ 2)
	if x % 2 != 0 and y % 2 != 0:
		l.append(x ^ 2)
		l.append(y ^ 2)
		l.append(2)
	l.sort()
	for i in l:
		print(i, end=' ')
	print()


t = int(input())
while t != 0:
	(x, y) = map(int, input().split())
	z = x ^ y
	arr = [2, 2, 2]
	if x & 1:
		arr[0] = x ^ 2
	if y & 1:
		arr[1] = y ^ 2
	if z & 1:
		arr[2] = z ^ 2
	arr.sort()
	print(*arr)
	t -= 1


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	ans = [2]
	if x % 2 == 1:
		ans.append(x ^ 2)
	if y % 2 == 1:
		ans.append(y ^ 2)
	if z % 2 == 1:
		ans.append(z ^ 2)
	ans.sort()
	print(ans[0], ' ', ans[1], ' ', ans[2])


for _ in range(int(input())):
	(x, y) = [int(i) for i in input().split()]
	if x % 2 == 0:
		b = 2 ^ y
		c = b ^ x
	elif y % 2 == 0:
		b = 2 ^ x
		c = b ^ y
	else:
		b = 2 ^ x
		c = 2 ^ y
	print(' '.join(['2', str(min(b, c)), str(max(b, c))]))


T = int(input())
for i in range(T):
	(X, Y) = map(int, input().split(' '))
	arr = [2, 2, 2]
	Z = X ^ Y
	if X & 1:
		arr[0] = X ^ 2
	if Y & 1:
		arr[1] = Y ^ 2
	if Z & 1:
		arr[2] = Z ^ 2
	arr.sort()
	print(arr[0], arr[1], arr[2])


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	z = x ^ y
	ans = [2]
	for n in (x, y, z):
		if n % 2:
			ans.append(n ^ 2)
	print(*sorted(ans))


t = int(input())
while t:
	(x, y) = map(int, input().split())
	z = x ^ y
	l = [2, 2, 2]
	if x & 1:
		l[0] = x ^ 2
	if y & 1:
		l[1] = y ^ 2
	if z & 1:
		l[2] = z ^ 2
	l.sort()
	for i in l:
		print(i, end=' ')
	print()
	t = t - 1


for case in range(int(input())):
	(X, Y) = map(int, input().split())
	if X % 2 and Y % 2:
		li = [2, X ^ 2, Y ^ 2]
	elif X % 2:
		li = [2, X ^ 2, Y ^ X ^ 2]
	else:
		li = [2, Y ^ 2, X ^ Y ^ 2]
	li.sort()
	print(*li)


testcases = int(input())
for eachcase in range(testcases):
	(x, y) = map(int, input().split())
	z = x ^ y
	arr = [2, 2, 2]
	if x & 1:
		arr[0] = x ^ 2
	if y & 1:
		arr[1] = y ^ 2
	if z & 1:
		arr[2] = z ^ 2
	arr.sort()
	print(*arr)


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	l = [2]
	if x & 1 and y & 1:
		l.append(x ^ 2)
		l.append(y ^ 2)
	elif x & 1:
		l.append(x ^ 2)
		l.append(l[-1] ^ y)
	else:
		l.append(y ^ 2)
		l.append(l[-1] ^ x)
	l.sort()
	print(*l)


I = lambda : input()
IN = lambda : int(input())
M = lambda : map(int, input().strip().split())
L = lambda : list(map(int, input().strip().split()))
LCHR = lambda : [i for i in input()]
LW = lambda : [i for i in input().split()]
for _ in range(IN()):
	(x, y) = M()
	l = [2]
	if x % 2 == 1 and y % 2 == 1:
		l.extend([x ^ 2, y ^ 2])
	if x % 2 == 1 and y % 2 == 0:
		l.extend([x ^ 2, y ^ (x ^ 2)])
	if x % 2 == 0 and y % 2 == 1:
		l.extend([x ^ (y ^ 2), y ^ 2])
	print(*sorted(l))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	z = x ^ y
	lst = [2]
	if x % 2 == 1:
		a = 2
		b = x ^ 2
		lst.append(b)
	if y % 2 == 1:
		b = 2
		c = y ^ 2
		lst.append(c)
	if z % 2 == 1:
		c = 2
		a = z ^ 2
		lst.append(a)
	lst.sort()
	print(*lst)


t = int(input())
for i in range(t):
	l = input().split()
	x = int(l[0])
	y = int(l[1])
	z = x ^ y
	a = [2, 2, 2]
	if x % 2 != 0:
		a[0] = x ^ 2
	if y % 2 == 1:
		a[1] = y ^ 2
	if z % 2 == 1:
		a[2] = z ^ 2
	a.sort()
	for j in range(3):
		print(a[j], end=' ')
	print()


def solution():
	(x, y) = list(map(int, input().split()))
	z = x ^ y
	ans = [2, 2, 2]
	if x & 1:
		ans[0] = x ^ 2
	if y & 1:
		ans[1] = y ^ 2
	if z & 1:
		ans[2] = z ^ 2
	ans.sort()
	print(ans[0], ans[1], ans[2])
n = int(input())
for i in range(n):
	solution()


for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	z = x ^ y
	if y % 2 != 0 and z % 2 != 0:
		c = 2
		b = y ^ c
		a = x ^ b
	elif x % 2 != 0 and y % 2 != 0:
		b = 2
		a = x ^ b
		c = z ^ a
	else:
		a = 2
		c = z ^ a
		b = c ^ y
	lis = [a, b, c]
	lis.sort()
	print(*lis)


for i in range(int(input())):
	(x, y) = [int(x) for x in input().split()]
	ans = []
	if x % 2 == 1:
		ans.append(x ^ 2)
		if y % 2 == 1:
			ans.append(y ^ 2)
		else:
			ans.append(y ^ ans[0])
	else:
		ans.append(y ^ 2)
		ans.append(ans[0] ^ x)
	ans.append(2)
	ans.sort()
	print(*ans)


def solve():
	(x, y) = map(int, input().split())
	res = [2]
	if x & 1 and y & 1:
		res.append(2 ^ x)
		res.append(2 ^ y)
	elif x & 1:
		res.append(2 ^ x)
		res.append(res[-1] ^ y)
	else:
		res.append(2 ^ y)
		res.append(res[-1] ^ x)
	print(' '.join(map(str, sorted(res))))
for _ in range(int(input())):
	solve()