During quarantine chef’s friend invented a game. In this game there are two players, player 1 and Player 2. In center of garden there is one finish circle and both players are at different distances respectively $X$ and $Y$ from finish circle.
Between finish circle and Player 1 there are $X$ number of circles and between finish circle and Player 2 there are $Y$ number of circles. Both player wants to reach finish circle with minimum number of jumps. Player can jump one circle to another circle.
Both players can skip $2^0-1$ or $2^1- 1$ or …. or $2^N-1$ circles per jump. A player cannot skip same number of circles in a match more than once. If both players uses optimal way to reach finish circle what will be the difference of minimum jumps needed to reach finish circle by both players. 
If both players reach finish circle with same number of jumps answer will be $0$ $0$.

-----Input:-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The 
description of $T$ test cases follows.
- The first line of each test case contains 2 space separated integers $X$ and $Y$.

-----Output:-----
For each test case, print a single line containing 2 space-separated integers which player win and what is the difference between number of minimum jump required by both players to reach finish circle.

-----Constraints-----
- $1 \leq T \leq 10^5$
- $1 \leq X,Y \leq 2*10^7$

-----Sample Input:-----
2
4 5
3 5

-----Sample Output:-----
0 0
1 1

-----Explanation:-----
Test Case 1:

Test Case 2:

Difficulty: UNKNOWN_DIFFICULTY

Starter code:

Solutions:
import math
for i in range(int(input())):
	(p, q) = list(map(int, input().split()))
	c = 0
	h = 0
	while q >= 0:
		if q == 0:
			h += 1
			break
		d = int(math.log2(q + 1))
		if d == 0:
			h += 1
			break
		y = 2 ** d - 1
		q -= y + 1
		if q == -1:
			h += 1
			break
		h += 1
	while p >= 0:
		if p == 0:
			c += 1
			break
		else:
			rem = int(math.log2(p + 1))
			if rem == 0:
				c += 1
				break
			y = 2 ** rem - 1
			p -= y + 1
			if p == -1:
				c += 1
				break
			c += 1
	if c == h:
		print(0, 0)
	if c < h:
		print(1, h - c)
	if c > h:
		print(2, c - h)


import math
t = int(input())
for i in range(t):
	(p, q) = list(map(int, input().split()))
	c = 0
	h = 0
	while p >= 0:
		if p == 0:
			c += 1
			break
		else:
			d = int(math.log(p + 1, 2))
			if d == 0:
				c += 1
				break
			y = 2 ** d - 1
			p -= y + 1
			if p == -1:
				c += 1
				break
			c += 1
	while q >= 0:
		if q == 0:
			h += 1
			break
		d = int(math.log(q + 1, 2))
		if d == 0:
			h += 1
			break
		y = 2 ** d - 1
		q -= y + 1
		if q == -1:
			h += 1
			break
		h += 1
	if c == h:
		print(0, 0)
	elif c < h:
		print(1, h - c)
	else:
		print(2, c - h)


l = [2 ** i - 1 for i in range(0, 25)]
for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	x_l = [i for i in l if i <= x]
	y_l = [i for i in l if i <= y]
	(count_x, count_y, final_x, final_y) = (0, 0, x + 1, y + 1)
	while True:
		temp = 0
		for i in range(len(x_l) - 1, -1, -1):
			if temp + (x_l[i] + 1) <= final_x:
				temp += x_l[i] + 1
				count_x += 1
				if temp == final_x:
					break
		break
	while True:
		temp = 0
		for i in range(len(y_l) - 1, -1, -1):
			if temp + (y_l[i] + 1) <= final_y:
				temp += y_l[i] + 1
				count_y += 1
				if temp == final_y:
					break
		break
	if count_x == count_y:
		print(0, 0)
	elif count_x < count_y:
		print(1, count_y - count_x)
	else:
		print(2, count_x - count_y)


takeArr = lambda : list(map(int, input().split()))
takeList = lambda : list(map(int, input().split()))
import sys
sys.setrecursionlimit(10 ** 6)
from math import floor, ceil, log2

def powOfPositive(n):
	pos = floor(log2(n))
	return 2 ** pos

def powOfNegative(n):
	pos = ceil(log2(n))
	return -1 * pow(2, pos)

def highestPowerOf2(n):
	if n > 0:
		return powOfPositive(n)
	else:
		n = -n
		return powOfNegative(n)

def main(t):
	(x, y) = takeArr()
	(a, b) = (x + 1, y + 1)
	sa = sb = 0
	while a:
		a -= highestPowerOf2(a)
		sa += 1
	while b:
		b -= highestPowerOf2(b)
		sb += 1
	winner = 2 if sa > sb else 1 if sb > sa else 0
	score = abs(sa - sb) if winner else 0
	print(winner, score)
	if t > 1:
		main(t - 1)
main(int(input()))


import sys
input = sys.stdin.readline
T = int(input().strip())
for _ in range(T):
	(X, Y) = list(map(int, input().split()))
	x = X + 1
	y = Y + 1

	def bit(x):
		a = []
		while x > 0:
			a.append(x & 1)
			x = x // 2
		return sum(a)
	count_x = bit(x)
	count_y = bit(y)
	if count_x < count_y:
		print('1', count_y - count_x)
	elif count_y < count_x:
		print('2', count_x - count_y)
	else:
		print('0', '0')


t = int(input())
for _ in range(t):
	(x, y) = list(map(int, input().split()))
	p = 0
	mx = max(x, y)
	while 2 ** p <= mx:
		p += 1
	px = p
	py = p
	x_m = 0
	y_m = 0
	x += 1
	y += 1
	while x:
		while 2 ** px > x:
			px -= 1
		x -= 2 ** px
		x_m += 1
	while y:
		while 2 ** py > y:
			py -= 1
		y -= 2 ** py
		y_m += 1
	if x_m == y_m:
		print(0, 0)
	elif x_m > y_m:
		print(2, abs(x_m - y_m))
	else:
		print(1, abs(x_m - y_m))


t = int(input())
for _ in range(t):
	(x, y) = list(map(int, input().split()))
	x += 1
	y += 1
	(ans1, ans2) = (bin(x)[2:].count('1'), bin(y)[2:].count('1'))
	if ans1 == ans2:
		print(0, 0)
	elif ans1 > ans2:
		print(2, abs(ans1 - ans2))
	else:
		print(1, abs(ans1 - ans2))


t = int(input())
for _ in range(t):
	(x, y) = list(map(int, input().split()))
	if x == y:
		print(0, 0)
	else:
		x_count = bin(x + 1).count('1')
		y_count = bin(y + 1).count('1')
		if x_count == y_count:
			print(0, 0)
		elif x_count < y_count:
			print(1, y_count - x_count)
		else:
			print(2, x_count - y_count)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	x = bin(x + 1)[2:].count('1')
	y = bin(y + 1)[2:].count('1')
	if x == y:
		print(0, 0)
	elif x < y:
		print(1, abs(x - y))
	else:
		print(2, abs(x - y))


def jumpsto(n):
	if n == 0:
		return 0
	elif n & n - 1 == 0:
		return 1
	jump = 0
	powe = 0
	n1 = n
	while n1 != 0:
		n1 = n1 // 2
		powe += 1
	powe -= 1
	jump += 1
	return jump + jumpsto(n - 2 ** powe)
for _ in range(int(input())):
	(x, y) = list(map(int, input().strip().split()))
	x += 1
	y += 1
	jumpx = jumpsto(x)
	jumpy = jumpsto(y)
	if jumpx == jumpy:
		print(0, 0)
	elif jumpx < jumpy:
		print(1, jumpy - jumpx)
	else:
		print(2, jumpx - jumpy)


import math

def jump(x, t=1):
	if x <= 0:
		return t + x
	n = int(math.log(x + 1, 2))
	n = x - 2 ** n
	return jump(n, t + 1)
t = int(input())
for _ in range(t):
	(x, y) = list(map(int, input().split()))
	x = jump(x)
	y = jump(y)
	if x == y:
		print('0 0')
	elif x > y:
		print(2, x - y)
	else:
		print(1, y - x)


from sys import stdin
import math

def func(x):
	count = 0
	while x > 0:
		n = int(math.log2(x + 1))
		k = 2 ** n
		count += 1
		if k > x:
			k //= 2
		x -= k
	return count
for _ in range(int(stdin.readline())):
	(x, y) = list(map(int, stdin.readline().split()))
	(a, b) = (func(x + 1), func(y + 1))
	if a == b:
		print(0, 0)
	elif a > b:
		print(2, a - b)
	else:
		print(1, b - a)


import math
d = 10 ** 8
e = [0]
p = 1
while p < d:
	p *= 2
	e.append(p - 1)
e = e[::-1]
for _ in range(int(input())):
	li = list(map(int, input().split()))
	ans1 = 0
	n1 = li[0] + 1
	ans2 = 0
	n2 = li[1] + 1
	for i in e:
		if n1 - i - 1 >= 0:
			n1 -= i
			n1 -= 1
			ans1 += 1
	ans1 += n1
	for i in e:
		if n2 - i - 1 >= 0:
			n2 -= i
			n2 -= 1
			ans2 += 1
	ans2 += n1
	if ans1 == ans2:
		print(0, 0)
	elif ans1 > ans2:
		print(2, ans1 - ans2)
	else:
		print(1, ans2 - ans1)


for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	c = list(bin(a + 1)[2:])
	d = list(bin(b + 1)[2:])
	e = c.count('1')
	f = d.count('1')
	if e == f:
		print(0, 0)
	elif e < f:
		print(1, f - e)
	else:
		print(2, e - f)


def fuck_off(x, y):
	X = bin(x + 1)[2:]
	Y = bin(y + 1)[2:]
	(count1, count2) = (0, 0)
	for i in X:
		if i == '1':
			count1 += 1
	for i in Y:
		if i == '1':
			count2 += 1
	if count1 == count2:
		print(0, ' ', 0)
	if count1 > count2:
		print(2, ' ', abs(count1 - count2))
	if count1 < count2:
		print(1, ' ', abs(count2 - count1))
t = int(input())
for i in range(t):
	(x, y) = input().split()
	fuck_off(int(x), int(y))


from sys import stdin as sin, stdout as sout
MOD = 1000000007
for _ in range(int(sin.readline())):
	(x, y) = map(int, sin.readline().split())
	(x, y) = (x + 1, y + 1)
	(xx, yy) = (bin(x).count('1'), bin(y).count('1'))
	ans = str(xx) + ' ' + str(yy)
	if xx == yy:
		sout.write(str('0 0') + '\n')
	elif xx > yy:
		sout.write(str('2 ') + str(xx - yy) + '\n')
	else:
		sout.write(str('1 ') + str(yy - xx) + '\n')


import math

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))
t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	step_x = 0
	step_y = 0
	if isPowerOfTwo(x + 1):
		step_x = 1
	else:
		while x >= 0:
			nx = Log2(x + 1)
			s = int(nx)
			x -= 2 ** s
			step_x += 1
	if isPowerOfTwo(y + 1):
		step_y = 1
	else:
		while y >= 0:
			ny = Log2(y + 1)
			s_y = int(ny)
			y -= 2 ** s_y
			step_y += 1
	if step_x == step_y:
		print(0, 0)
	elif step_x > step_y:
		print(2, abs(step_x - step_y))
	else:
		print(1, abs(step_x - step_y))


from math import log2, floor
for _ in range(int(input())):
	(x, y) = list(map(int, input().split()))
	(count1, count2) = (0, 0)
	while True:
		z = floor(log2(x + 1))
		x = x - (2 ** z - 1)
		x -= 1
		count1 += 1
		if x < 0:
			break
	while True:
		z = floor(log2(y + 1))
		y = y - (2 ** z - 1)
		y -= 1
		count2 += 1
		if y < 0:
			break
	if count1 == count2:
		print(0, 0)
	if count1 > count2:
		print(2, abs(count1 - count2))
	if count2 > count1:
		print(1, count2 - count1)


test_cases = int(input())
for i in range(test_cases):
	(X, Y) = map(int, input().split())
	X += 1
	Y += 1
	x = str(bin(X))
	y = str(bin(Y))
	count1 = 0
	count2 = 0
	for i in x:
		if i == '1':
			count1 += 1
	for i in y:
		if i == '1':
			count2 += 1
	if count1 > count2:
		print(2, abs(count1 - count2))
	elif count2 > count1:
		print(1, abs(count1 - count2))
	else:
		print(0, 0)


def main():
	T = int(input())
	while T:
		(a, b) = list(map(int, input().split()))
		c1 = bin(a + 1).count('1')
		c2 = bin(b + 1).count('1')
		if c1 > c2:
			print(2, c1 - c2)
		elif c1 < c2:
			print(1, c2 - c1)
		else:
			print('0 0')
		T -= 1

def __starting_point():
	main()
__starting_point()


from math import log
for _ in range(int(input())):
	(x, y) = map(int, input().split())
	x += 1
	y += 1
	(c1, c2) = (0, 0)
	while x > 0:
		x = x - 2 ** int(log(x, 2))
		c1 += 1
	while y > 0:
		y = y - 2 ** int(log(y, 2))
		c2 += 1
	if c1 == c2:
		print(0, 0)
	elif c1 > c2:
		print(2, c1 - c2)
	else:
		print(1, c2 - c1)