Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.

Chef is playing a card game with his friend Rick Sanchez. He recently won against Rick's grandson Morty; however, Rick is not as easy to beat. The rules of this game are as follows:
The *power* of a positive integer is the sum of digits of that integer. For example, the power of $13$ is $1+3 = 4$.
Chef and Rick receive randomly generated positive integers. For each player, let's call the integer he received *final power*.
The goal of each player is to generate a positive integer such that its power (defined above) is equal to his final power.
The player who generated the integer with fewer digits wins the game. If both have the same number of digits, then Rick cheats and wins the game.

You are given the final power of Chef $P_{C}$ and the final power of Rick $P_{R}$. Assuming that both players play optimally, find the winner of the game and the number of digits of the integer he generates.

------  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 and only line of each test case contains two space-separated integers $P_{C}$ and $P_{R}$.

------  Output ------
For each test case, print a single line containing two space-separated integers. The first of these integers should be either $0$ if Chef wins or $1$ if Rick wins. The second integer should be the number of digits of the integer generated by the winner.

------  Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ P_{C}, P_{R} ≤ 10^{6}$

------  Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
3

3 5

28 18

14 24
----- Sample Output 1 ------ 
1 1

1 2

0 2
----- explanation 1 ------ 
Example case 1: Chef and Rick generate the optimal integers $3$ and $5$ respectively. Each of them has $1$ digit, so Rick cheats and wins the game.

Example case 2: Chef and Rick could generate e.g. $6877$ and $99$ respectively. Since Rick's integer has $2$ digits and Chef cannot generate an integer with less than $4$ digits, Rick wins.

Example case 3: Chef and Rick could generate e.g. $86$ and $888$ respectively. Chef's integer has $2$ digits and Rick cannot generate an integer with less than $3$ digits, so Chef wins.

Difficulty: EASY

Solutions:
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 9 == 0:
		A = a // 9
	else:
		A = a // 9 + 1
	if b % 9 == 0:
		B = b // 9
	else:
		B = b // 9 + 1
	if A < B:
		print(f'0 {A}')
	else:
		print(f'1 {B}')


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	x = math.ceil(a / 9)
	y = math.ceil(b / 9)
	if x < y:
		print(0, x)
	elif y < x:
		print(1, y)
	else:
		print(1, x)


for _ in range(int(input())):
	(C, R) = map(int, input().split())
	if C % 9 == 0:
		C_len = C // 9
	else:
		C_len = C // 9 + 1
	if R % 9 == 0:
		R_len = R // 9
	else:
		R_len = R // 9 + 1
	if R_len <= C_len:
		print(1, R_len)
	else:
		print(0, C_len)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	c = math.ceil(a / 9)
	d = math.ceil(b / 9)
	if c == d:
		print(1, c)
	else:
		if c < d:
			print(0, min(c, d))
		if c > d:
			print(1, min(c, d))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	ak = math.ceil(a / 9)
	bk = math.ceil(b / 9)
	if ak == bk:
		print(ak, ak)
	else:
		if ak < bk:
			print(0, min(ak, bk))
		if ak > bk:
			print(1, min(ak, bk))


for _ in range(int(input())):
	(c, r) = map(int, input().split())
	(pc, pr) = (0, 0)
	if c % 9:
		pc += 1
	pc += c // 9
	if r % 9:
		pr += 1
	pr += r // 9
	if pc == pr:
		print(1, pc)
	elif pc < pr:
		print(0, pc)
	else:
		print(1, pr)


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = ceil(a / 9)
	y = ceil(b / 9)
	if x < y:
		print(0, x)
	else:
		print(1, y)


import math
for _ in range(int(input())):
	(c, r) = map(int, input().split())
	n = math.ceil(c / 9)
	a = math.ceil(r / 9)
	if n < a:
		print('0', n)
	elif a <= n:
		print('1', a)


t = int(input())
for i in range(t):
	c_r = input().split(' ')
	(c, r) = (int(c_r[0]), int(c_r[1]))
	if c < 10 and r < 10:
		print(1, 1)
	elif c >= 10 and r < 10:
		print(1, 1)
	else:
		if c % 9 != 0:
			n_c = c // 9 + 1
		else:
			n_c = c // 9
		if r % 9 != 0:
			n_r = r // 9 + 1
		else:
			n_r = r // 9
		if n_r <= n_c:
			print(1, n_r)
		else:
			print(0, n_c)


t = int(input())
for tc in range(t):
	(c, r) = map(int, input().split())
	c1 = c // 9
	r1 = r // 9
	if c % 9 != 0:
		c1 += 1
	if r % 9 != 0:
		r1 += 1
	if r1 <= c1:
		print('1', r1)
	else:
		print('0', c1)


import math
for i in range(int(input())):
	N = list(map(int, input().split()))
	a = N[0]
	b = N[1]
	P = ''
	if b < 9:
		P = P + str(1) + ' '
		P = P + str(math.ceil(b / 9))
	elif a > b:
		P = P + str(1) + ' '
		P = P + str(math.ceil(b / 9))
	else:
		P = P + str(0) + ' '
		P = P + str(math.ceil(a / 9))
	print(P)


def dig(n):
	digits = 0
	while n > 0:
		n = n - 9
		digits += 1
	return digits
for _ in range(int(input())):
	(c, r) = map(int, input().split())
	r_digits = r // 9
	c_digits = c // 9
	if c % 9 != 0:
		c_digits += 1
	if r % 9 != 0:
		r_digits += 1
	if r_digits <= c_digits:
		print('1 ' + str(r_digits))
	else:
		print('0 ' + str(c_digits))


for _ in range(int(input())):
	(c, r) = map(int, input().split())
	r_digits = r // 9
	c_digits = c // 9
	if c % 9 != 0:
		c_digits += 1
	if r % 9 != 0:
		r_digits += 1
	if r_digits <= c_digits:
		print('1 ' + str(r_digits))
	else:
		print('0 ' + str(c_digits))


import math
tc = int(input())
for _ in range(tc):
	(c, r) = map(int, input().split())
	dc = math.ceil(c / 9)
	dr = math.ceil(r / 9)
	if dc < dr:
		print(0, dc)
	else:
		print(1, dr)


import math
t = int(input())
for i in range(t):
	(pc, pr) = map(int, input().split())
	c = math.ceil(pc / 9)
	d = math.ceil(pr / 9)
	if d < c:
		print('1', d)
	elif d > c:
		print('0', c)
	else:
		print('1', c)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	(a1, a2) = (math.ceil(a / 9), math.ceil(b / 9))
	if a1 < a2:
		print(0, a1)
	else:
		print(1, a2)


for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	a = x // 9
	b = y // 9
	c = x % 9
	d = y % 9
	if a == b:
		if c == 0:
			print(1, b)
		else:
			print(1, b + 1)
	elif a < b:
		if c == 0:
			print(0, a)
		else:
			print(0, a + 1)
	elif d == 0:
		print(1, b)
	else:
		print(1, b + 1)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	aa = a // 9
	bb = b // 9
	if a % 9 != 0:
		aa = aa + 1
	if b % 9 != 0:
		bb = bb + 1
	if aa < bb:
		print('0', aa, sep=' ')
	else:
		print('1', bb, sep=' ')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = 0
	if b // 9 <= a // 9:
		t = 1
		n = b
	else:
		t = 0
		n = a
	if n % 9 == 0:
		x = n // 9
	else:
		x = n // 9 + 1
	print(t, x)


import math
for tc in range(int(input())):
	(c, r) = map(int, input().split())
	cn = math.ceil(c / 9)
	rn = math.ceil(r / 9)
	if cn < rn:
		print(0, cn)
	else:
		print(1, rn)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x < 10 and y < 10:
		print(1, 1)
	elif x < 10 and y > 9:
		print(0, 1)
	elif x > 9 and y < 10:
		print(1, 1)
	elif x > 9 and y > 9:
		if x < y:
			if x % 9 == 0:
				print(0, int(x / 9))
			else:
				print(0, x // 9 + 1)
		elif y % 9 == 0:
			print(1, int(y / 9))
		else:
			print(1, y // 9 + 1)


import math as m
for i in range(int(input())):
	(pc, pr) = map(int, input().split())
	pc = m.ceil(pc / 9)
	pr = m.ceil(pr / 9)
	if pc > pr:
		print(1, pr)
	elif pc < pr:
		print(0, pc)
	else:
		print(1, pr)


for i in range(int(input())):
	(c, r) = map(int, input().split())
	c1 = c // 9
	c2 = r // 9
	if c1 < c2:
		print(0, end=' ')
		if c % 9 == 0:
			print(c // 9)
		else:
			print(c // 9 + 1)
	else:
		print(1, end=' ')
		if r % 9 == 0:
			print(r // 9)
		else:
			print(r // 9 + 1)


x = int(input())
final = []
for iio in range(0, x):
	vb = str(input())
	gbhy = vb.split(' ')
	lp = []
	for iie in gbhy:
		lp.append(int(iie))
	final.append(lp)
for kker in final:
	ty = kker[0]
	opt = kker[1]
	if len(str(ty)) == 1 and len(str(opt)) == 1:
		print('1 1')
	else:
		hnjk = ty // 9
		oply = opt // 9
		pt = 0
		lpt = 0
		if hnjk == 0:
			pt += 1
		else:
			ty = ty - int(9 * hnjk)
			if ty != 0:
				pt = hnjk + 1
			else:
				pt = hnjk
		if oply == 0:
			lpt += 1
		else:
			opt = opt - int(9 * oply)
			if opt != 0:
				lpt = oply + 1
			else:
				lpt = oply
		if pt == lpt:
			print('1' + ' ' + str(lpt))
		if pt < lpt:
			print('0' + ' ' + str(pt))
		if lpt < pt:
			print('1' + ' ' + str(lpt))


import math as m
for _ in range(int(input())):
	(pc, pr) = map(int, input().split())
	(pcc, prc) = (m.ceil(pc / 9), m.ceil(pr / 9))
	if pcc > prc:
		print(1, prc)
	elif pcc < prc:
		print(0, pcc)
	else:
		print(1, prc)


import math
T = int(input())
x = range(T)
for i in x:
	(a, b) = map(int, input().split())
	c = math.ceil(a / 9)
	d = math.ceil(b / 9)
	if d < c:
		print('1', d)
	elif d > c:
		print('0', c)
	else:
		print('1', c)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	a = a / 9
	b = b / 9
	if int(a) < int(b):
		status = 0
		if a == int(a):
			value = int(a)
		else:
			value = int(a) + 1
	elif int(a) >= int(b):
		status = 1
		if b == int(b):
			value = int(b)
		else:
			value = int(b) + 1
	print(status, value)


for _ in range(int(input())):
	(c, r) = map(int, input().split())
	d = 0
	e = 0
	if r % 9 > 0:
		d += r // 9 + 1
	else:
		d += r // 9
	if c % 9 > 0:
		e += c // 9 + 1
	else:
		e += c // 9
	if d == e:
		print(1, d)
	elif d < e:
		print(1, d)
	else:
		print(0, e)


import math
for _ in range(int(input())):
	(c, r) = map(int, input().split())
	(d1, d2) = (math.ceil(c / 9), math.ceil(r / 9))
	if d1 == d2:
		print(1, d1)
	elif d1 > d2:
		print(1, d2)
	else:
		print(0, d1)


import math

def no_dig(n):
	k = n / 9
	k = math.ceil(k)
	return k
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = no_dig(a)
	b = no_dig(b)
	if a < b:
		print(0, a)
	else:
		print(1, b)


import math
t = int(input())
for i in range(t):
	(ch, ri) = map(int, input().split())
	num = ch
	cc = math.ceil(ch / 9)
	cr = math.ceil(ri / 9)
	if cr < cc:
		print('1', cr)
	elif cr > cc:
		print('0', cc)
	else:
		print('1', cc)


for a in range(int(input())):
	(x, y) = map(int, input().split())
	s = abs(x - y)
	c = min(x, y) // 9 + 1
	if min(x, y) % 9 == 0:
		c = c - 1
	w = 0
	if s < 9:
		w = 1
	elif y == min(x, y):
		w = 1
	print(w, c)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	subs = abs(a - b)
	d = min(a, b) // 9 + 1
	if min(a, b) % 9 == 0:
		d -= 1
	we = 0
	if subs < 9:
		we = 1
	elif b == min(a, b):
		we = 1
	print(we, d)


for i in range(int(input())):
	(a, b) = map(int, input().split())
	sub = abs(a - b)
	d = min(a, b) // 9 + 1
	if min(a, b) % 9 == 0:
		d -= 1
	w = 0
	if sub < 9:
		w = 1
	elif b == min(a, b):
		w = 1
	print(w, d)


t = int(input())
for _ in range(t):
	(d1, d2) = (0, 0)
	(pc, pr) = map(int, input().split())
	if pc % 9 == 0:
		d1 = pc // 9
	else:
		d1 = pc // 9 + 1
	if pr % 9 == 0:
		d2 = pr // 9
	else:
		d2 = pr // 9 + 1
	if d1 < d2:
		print(0, d1)
	else:
		print(1, d2)


from math import ceil
for _ in range(int(input())):
	(c, r) = map(int, input().split())
	(d_c, d_r) = (ceil(c / 9), ceil(r / 9))
	if d_c >= d_r:
		print(1, d_r)
	else:
		print(0, d_c)


for _ in range(int(input())):
	CR = input()
	lst = CR.split()
	C = int(lst[0])
	R = int(lst[1])
	c = C // 9
	r = R // 9
	if C % 9 != 0:
		c += 1
	if R % 9 != 0:
		r += 1
	if c < r:
		print(0, c)
	else:
		print(1, r)


from math import floor
for t in range(int(input())):
	(c, r) = map(int, input().split())
	if c % 9 == 0:
		c = c / 9
	else:
		c = floor(c / 9) + 1
	if r % 9 == 0:
		r = r / 9
	else:
		r = floor(r / 9) + 1
	if c < r:
		print('0', int(c))
	else:
		print('1', int(r))


t = int(input())
while t > 0:
	(a, b) = map(int, input().split())
	c = 0
	d = 0
	if a // 9 != a / 9:
		c = a // 9 + 1
	else:
		c = a // 9
	if b // 9 != b / 9:
		d = b // 9 + 1
	else:
		d = b // 9
	if c == d:
		print(1, 1)
	elif c > d:
		print(1, d)
	else:
		print(0, c)
	t = t - 1


t = int(input())
while t != 0:
	(n, m) = map(int, input().split())
	if m // 9 == m / 9:
		k = m // 9
	else:
		k = m // 9 + 1
	if n // 9 == n / 9:
		p = n // 9
	else:
		p = n // 9 + 1
	if p == k:
		print(1, k)
	elif p > k:
		print(1, k)
	else:
		print(0, p)
	t -= 1


from math import floor
t = int(input())
for ni in range(t):
	(a, b) = map(int, input().split())
	if a % 9 == 0:
		a = a / 9
	else:
		a = floor(a / 9) + 1
	if b % 9 == 0:
		b = b / 9
	else:
		b = floor(b / 9) + 1
	if a < b:
		print(0, int(a))
	else:
		print(1, int(b))


t = int(input())
while t != 0:
	(a, b) = map(int, input().split())
	x = a // 9
	if a % 9 != 0:
		x += 1
	y = b // 9
	if b % 9 != 0:
		y += 1
	if x < y:
		print(0, x)
	else:
		print(1, y)
	t -= 1


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(digit_n, digit_k) = (math.ceil(n / 9), math.ceil(k / 9))
	if digit_k == digit_n:
		print(1, digit_n, sep=' ')
	elif digit_n > digit_k:
		print(1, digit_k, sep=' ')
	else:
		print(0, digit_n, sep=' ')


t = int(input())
for i in range(t):
	(c, r) = map(int, input().split())
	a = 0
	b = 0
	if c % 9 == 0:
		a = c // 9
	else:
		a = c // 9 + 1
	if r % 9 == 0:
		b = r // 9
	else:
		b = r // 9 + 1
	if a < b:
		print(0, a)
	else:
		print(1, b)


t = int(input())
while t:
	(a, b) = map(int, input().split())
	r = 0
	c = 0
	if a % 9 == 0:
		c = a // 9
	else:
		c = a // 9 + 1
	if b % 9 == 0:
		r = b // 9
	else:
		r = b // 9 + 1
	print(0, c) if c < r else print(1, r)
	t -= 1


import math
for z in range(int(input())):
	(p, q) = map(int, input().split())
	if math.ceil(p / 9) > math.ceil(q / 9):
		print(1, math.ceil(q / 9))
	elif math.ceil(p / 9) < math.ceil(q / 9):
		print(0, math.ceil(p / 9))
	else:
		print(1, math.ceil(p / 9))


import math
for _ in range(int(input())):
	(c, r) = map(int, input().split())
	a = math.ceil(c / 9)
	b = math.ceil(r / 9)
	if b <= a:
		print(1, b)
	else:
		print(0, a)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	r1 = math.ceil(a / 9)
	r2 = math.ceil(b / 9)
	if r1 >= r2:
		print('1', end=' ')
		print(r2)
	else:
		print('0', end=' ')
		print(r1)


import math as m
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	c = m.ceil(a / 9)
	d = m.ceil(b / 9)
	if c < d:
		print('0', c)
	else:
		print('1', d)


t = int(input())
for k in range(t):
	(a, b) = map(int, input().split())
	c = int(a / 9)
	if c * 9 != a:
		e = str(a - c * 9)
		c += len(e)
	d = int(b / 9)
	if d * 9 != b:
		f = str(b - d * 9)
		d += len(f)
	if c < d:
		print(0, c)
	elif d < c:
		print(1, d)
	else:
		print(1, d)


n = int(input())
import math
for i in range(n):
	(a, b) = map(int, input().split())
	(a1, a2) = (math.floor(a / 9), a % 9)
	if a2 > 0:
		a1 += 1
	(b1, b2) = (math.floor(b / 9), b % 9)
	if b2 > 0:
		b1 += 1
	if b1 <= a1:
		print('1 ' + str(b1))
	else:
		print('0 ' + str(a1))


import math
T = int(input())
for cases in range(T):
	(Pc, Pr) = input().split()
	Pc_Digits = math.ceil(int(Pc) / 9)
	Pr_Digits = math.ceil(int(Pr) / 9)
	if Pc_Digits < Pr_Digits:
		print(0, Pc_Digits)
	else:
		print(1, Pr_Digits)


test = int(input())
for z in range(test):
	(C, R) = map(int, input().split())
	if C % 9 == 0:
		C = C // 9
	else:
		C = C // 9 + 1
	if R % 9 == 0:
		R = R // 9
	else:
		R = R // 9 + 1
	if C < R:
		print(0, C)
	else:
		print(1, R)


for tc in range(int(input())):
	(c, r) = map(int, input().split())
	cp = c // 9 + (c % 9 > 0)
	rp = r // 9 + (r % 9 > 0)
	if cp == rp:
		print(1, rp)
	elif cp < rp:
		print(0, cp)
	else:
		print(1, rp)


try:
	for _ in range(int(input())):
		(Pc, Pr) = map(int, input().split())
		Dc = Pc // 9
		Dr = Pr // 9
		if Pc % 9:
			Dc += 1
		if Pr % 9:
			Dr += 1
		if Dc < Dr:
			print(0, Dc)
		else:
			print(1, Dr)
except:
	pass


def digs_4_pow(x):
	res = x // 9
	if x % 9 > 0:
		res += 1
	return res
t = int(input())
for _ in range(t):
	(c, r) = map(int, input().split())
	c_digs = digs_4_pow(c)
	r_digs = digs_4_pow(r)
	if c_digs < r_digs:
		print(0, c_digs)
	else:
		print(1, r_digs)