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

In a season, each player has three statistics: runs, wickets, and catches. Given the season stats of two players A and B, denoted by R, W, and C respectively, the person who is better than the other in the most statistics is regarded as the better overall player. Tell who is better amongst A and B. It is known that in each statistic, the players have different values.

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

- The first line contains an integer T, the number of test cases. Then the test cases follow.
- Each test case contains two lines of input.
- The first line contains three integers R_{1}, W_{1}, C_{1}, the stats for player A.
- The second line contains three integers R_{2}, W_{2}, C_{2}, the stats for player B.

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

For each test case, output in a single line "A" (without quotes) if player A is better than player B and "B" (without quotes) otherwise.

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

$1 ≤ T ≤ 1000$
$0 ≤ R_{1}, R_{2} ≤ 500$
$0 ≤ W_{1}, W_{2} ≤ 20$
$0 ≤ C_{1}, C_{2} ≤ 20$
$R_{1} \neq R_{2}$
$W_{1} \neq W_{2}$
$C_{1} \neq C_{2}$

------ subtasks ------ 

Subtask 1 (30 points): $1 ≤ R ≤ 10000$
Subtask 2 (70 points): $1 ≤ R ≤ 10^{9}$

----- Sample Input 1 ------ 
3
0 1 2
2 3 4
10 10 10
8 8 8
10 0 10
0 10 0
----- Sample Output 1 ------ 
B
A
A
----- explanation 1 ------ 
Test Case $1$: Player $B$ is better than $A$ in all $3$ fields.

Test Case $2$: Player $A$ is better than $B$ in all $3$ fields.

Test Case $3$: Player $A$ is better than $B$ in runs scored and number of catches.

Difficulty: EASY

Solutions:
for i in range(int(input())):
	ac = 0
	bc = 0
	(r, w, c) = map(int, input().split())
	(a, b, d) = map(int, input().split())
	if r > a:
		ac += 1
	else:
		bc += 1
	if w > b:
		ac += 1
	else:
		bc += 1
	if c > d:
		ac += 1
	else:
		bc += 1
	if ac > bc:
		print('A')
	else:
		print('B')


T = int(input())
for _ in range(T):
	(R_A, W_A, C_A) = map(int, input().split())
	(R_B, W_B, C_B) = map(int, input().split())
	if R_A > R_B:
		if W_A > W_B:
			print('A')
		elif C_A > C_B:
			print('A')
		else:
			print('B')
	elif W_A > W_B:
		if C_A > C_B:
			print('A')
		else:
			print('B')
	else:
		print('B')


for _testcase in range(int(input())):
	(a, b, c) = map(int, input().split())
	(d, e, f) = map(int, input().split())
	acount = 0
	bcount = 0
	if a > d:
		acount += 1
	else:
		bcount += 1
	if b > e:
		acount += 1
	else:
		bcount += 1
	if c > f:
		acount += 1
	else:
		bcount += 1
	if acount > bcount:
		print('A')
	else:
		print('B')


T = int(input())
for i in range(0, T):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	count = 0
	if R1 > R2:
		count += 1
	else:
		count -= 1
	if W1 > W2:
		count += 1
	else:
		count -= 1
	if C1 > C2:
		count += 1
	else:
		count -= 1
	if count > 0:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	a = input().split()
	b = input().split()
	x = y = 0
	for j in range(3):
		if int(a[j]) > int(b[j]):
			x += 1
		else:
			y += 1
	if x > y:
		print('A')
	else:
		print('B')
		i


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	(d, e, f) = map(int, input().split())
	t = 0
	l = 0
	if a > d:
		t = t + 1
	else:
		l = l + 1
	if b > e:
		t = t + 1
	else:
		l = l + 1
	if c > f:
		t = t + 1
	else:
		l = l + 1
	if t > l:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	p = 0
	n = 0
	if R1 > R2:
		p += 1
	else:
		n += 1
	if W1 > W2:
		p += 1
	else:
		n += 1
	if C1 > C2:
		p += 1
	else:
		n += 1
	if p > n:
		print('A')
	else:
		print('B')


n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	p = list(map(int, input().split()))
	lst1 = list(map(lambda a1, a2: a1 > a2, m, p))
	hihi = lst1.count(True)
	haha = lst1.count(False)
	if hihi > haha:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	a = 0
	b = 0
	for j in range(len(l1)):
		if l1[j] > l2[j]:
			a += 1
		else:
			b += 1
	if a > b:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	l1 = list(map(int, input().split()))
	l2 = list(map(int, input().split()))
	a = 0
	b = 0
	for i in range(3):
		if l1[i] > l2[i]:
			a = a + 1
		else:
			b = b + 1
	if a > b:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	a = input().split(' ')
	b = input().split(' ')
	ab = 0
	cd = 0
	for i in range(3):
		if int(a[i]) > int(b[i]):
			ab += 1
		else:
			cd += 1
	if ab > cd:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c3) = map(int, input().split())
	a = 0
	b = 0
	if r1 > r2:
		a = a + 1
	else:
		b = b + 1
	if w1 > w2:
		a = a + 1
	else:
		b = b + 1
	if c1 > c3:
		a = a + 1
	else:
		b = b + 1
	if a > b:
		print('A')
	else:
		print('B')


for t in range(int(input())):
	l = list(map(int, input().split()))
	y = list(map(int, input().split()))
	c = 0
	a = 0
	for i in range(len(l)):
		if l[i] < y[i]:
			c += 1
		if l[i] > y[i]:
			a += 1
	if a < c:
		print('B')
	else:
		print('A')


for i in range(int(input())):
	lst1 = list(map(int, input().split()))
	lst2 = list(map(int, input().split()))
	num1 = num2 = 0
	for i in range(3):
		if lst1[i] > lst2[i]:
			num1 += 1
		else:
			num2 += 1
	print('A' if num1 > num2 else 'B')


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	acount = 0
	bcount = 0
	for i in range(3):
		if a[i] > b[i]:
			acount += 1
		elif b[i] > a[i]:
			bcount += 1
	if acount > bcount:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	A = B = 0
	if r1 > r2:
		A += 1
	else:
		B += 1
	if w1 > w2:
		A += 1
	else:
		B += 1
	if c1 > c2:
		A += 1
	else:
		B += 1
	print('A' if A > B else 'B')


for t in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	d1 = 0
	d2 = 0
	if r1 > r2:
		d1 += 1
	else:
		d2 += 1
	if w1 > w2:
		d1 += 1
	else:
		d2 += 1
	if c1 > c2:
		d1 += 1
	else:
		d2 += 1
	if d1 > d2:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(x, y) = (0, 0)
	for i in range(3):
		if a[i] > b[i]:
			x += 1
		else:
			y += 1
	if x > y:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	(x, y, z) = map(int, input().split())
	A = 0
	B = 0
	if a > x:
		A += 1
	else:
		B += 1
	if b > y:
		A += 1
	else:
		B += 1
	if c > z:
		A += 1
	else:
		B += 1
	if A > B:
		print('A')
	else:
		print('B')


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	(d, e, f) = map(int, input().split())
	count = 0
	count1 = 0
	if a > d:
		count = count + 1
	else:
		count1 = count + 1
	if b > e:
		count = count + 1
	else:
		count1 = count1 + 1
	if c > f:
		count = count + 1
	else:
		count1 = count1 + 1
	if count > count1:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	a = [int(a) for a in input().split()]
	b = [int(b) for b in input().split()]
	a_count = 0
	b_count = 0
	for i in range(3):
		if a[i] > b[i]:
			a_count += 1
		elif b[i] > a[i]:
			b_count += 1
	if a_count > b_count:
		print('A')
	else:
		print('B')


T = int(input())
for _ in range(T):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	A = (R1 > R2) + (W1 > W2) + (C1 > C2)
	B = 3 - A
	print('A') if A > B else print('B')


t = int(input())
for i in range(t):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	l = []
	l1 = []
	l.append(r1)
	l.append(w1)
	l.append(c1)
	l1.append(r2)
	l1.append(w2)
	l1.append(c2)
	c = c1 = 0
	for i in range(len(l)):
		for j in range(len(l1)):
			if l[i] > l1[i]:
				c = c + 1
			else:
				c1 = c1 + 1
	if c > c1:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	if (R1 > R2) + (W1 > W2) + (C1 > C2) >= 2:
		print('A')
	else:
		print('B')


s = int(input())
for i in range(s):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	cnt = 0
	for i in range(len(a)):
		if a[i] > b[i]:
			cnt += 1
	if cnt > len(a) - cnt:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	ls = [r1, w1, c1, r2, w2, c2]
	a_points = sum([1 if ls[i] > ls[i + 3] else 0 for i in range(3)])
	b_points = sum([1 if ls[i + 3] > ls[i] else 0 for i in range(3)])
	print('A') if a_points > b_points else print('B')


t = int(input())
for i in range(t):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	a = 0
	b = 0
	if max(r1, r2) == r1:
		a = a + 1
	else:
		b = b + 1
	if max(c1, c2) == c1:
		a = a + 1
	else:
		b = b + 1
	if max(w1, w2) == w1:
		a = a + 1
	else:
		b = b + 1
	if a > b:
		print('A')
	else:
		print('B')


t = int(input())
for _ in range(t):
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	(c1, c2) = (0, 0)
	for i in range(3):
		if A[i] > B[i]:
			c1 = c1 + 1
		elif A[i] < B[i]:
			c2 = c2 + 1
	if c1 > c2:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	(r1, w1, c1) = [int(i) for i in input().split()]
	(r2, w2, c2) = [int(i) for i in input().split()]
	if r1 > r2 and w1 > w2 or (r1 > r2 and c1 > c2) or (w1 > w2 and c1 > c2):
		print('A')
	else:
		print('B')


T = int(input())
for _ in range(T):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	A_count = 0
	B_count = 0
	if R1 > R2:
		A_count += 1
	else:
		B_count += 1
	if W1 > W2:
		A_count += 1
	else:
		B_count += 1
	if C1 > C2:
		A_count += 1
	else:
		B_count += 1
	if A_count > B_count:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	(a1, b1, c1) = map(int, input().split())
	d1 = 0
	d2 = 0
	if a > a1:
		d1 += 1
	else:
		d2 += 1
	if b > b1:
		d1 += 1
	else:
		d2 += 1
	if c > c1:
		d1 += 1
	else:
		d2 += 1
	if d1 > d2:
		print('A')
	else:
		print('B')


for a in range(int(input())):
	(ra, wa, ca) = map(int, input().split())
	(rb, wb, cb) = map(int, input().split())
	a = 0
	b = 0
	if ra > rb:
		a += 1
	else:
		b += 1
	if wa > wb:
		a += 1
	else:
		b += 1
	if ca > cb:
		a += 1
	else:
		b += 1
	print('A') if a > b else print('B')


t = int(input())
for i in range(t):
	a_stat = list(map(int, input().split()))
	b_stat = list(map(int, input().split()))
	count_a = 0
	count_b = 0
	for i in range(3):
		if a_stat[i] > b_stat[i]:
			count_a += 1
		else:
			count_b += 1
	print('A') if count_a > count_b else print('B')


for i in range(int(input())):
	(h1, h2, h3) = map(int, input().split())
	(m1, m2, m3) = map(int, input().split())
	c1 = 0
	c2 = 0
	if h1 > m1:
		c1 += 1
	else:
		c2 += 1
	if h2 > m2:
		c1 += 1
	else:
		c2 += 1
	if h3 > m3:
		c1 += 1
	else:
		c2 += 1
	if c1 > c2:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(l, r, s) = map(int, input().split())
	(n, b, k) = map(int, input().split())
	f = 0
	f1 = 0
	if l > n:
		f += 1
	else:
		f1 += 1
	if r > b:
		f += 1
	else:
		f1 += 1
	if s > k:
		f += 1
	else:
		f1 += 1
	if f > f1:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	ac = 0
	bc = 0
	(a, b, c) = map(int, input().split(' '))
	(d, e, f) = map(int, input().split(' '))
	if a > d:
		ac += 1
	else:
		bc += 1
	if b > e:
		ac += 1
	else:
		bc += 1
	if c > f:
		ac += 1
	else:
		bc += 1
	if ac > bc:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count1 = 0
	count2 = 0
	for i in range(3):
		if a[i] > b[i]:
			count1 += 1
		else:
			count2 += 1
	if count1 > count2:
		print('A')
	else:
		print('B')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	(d, e, f) = map(int, input().split())
	if a > d and b > e or (a > d and c > f) or (b > e and c > f):
		print('A')
	else:
		print('B')


for case in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	counta = countb = 0
	if r1 > r2:
		counta += 1
	else:
		countb += 1
	if w1 > w2:
		counta += 1
	else:
		countb += 1
	if c1 > c2:
		counta += 1
	else:
		countb += 1
	if counta > countb:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	(c, d) = (0, 0)
	if r1 > r2:
		c += 1
	else:
		d += 1
	if w1 > w2:
		c += 1
	else:
		d += 1
	if c1 > c2:
		c += 1
	else:
		d += 1
	if c > d:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	Astats = list(map(int, input().split()))
	Bstats = list(map(int, input().split()))
	(Acount, Bcount) = (0, 0)
	for i in range(3):
		if Astats[i] > Bstats[i]:
			Acount += 1
		else:
			Bcount += 1
	print('A') if Acount > Bcount else print('B')


for tc in range(int(input())):
	A = list(map(int, input().split()))
	B = list(map(int, input().split()))
	count_A = 0
	count_B = 0
	for i in range(len(A)):
		if A[i] > B[i]:
			count_A += 1
		else:
			count_B += 1
	if count_A > count_B:
		print('A')
	else:
		print('B')


def better_player(r1, w1, c1, r2, w2, c2):
	A_stats = 0
	if r1 > r2:
		A_stats += 1
	if c1 > c2:
		A_stats += 1
	if w1 > w2:
		A_stats += 1
	B_stats = 0
	if r1 < r2:
		B_stats += 1
	if c1 < c2:
		B_stats += 1
	if w1 < w2:
		B_stats += 1
	if A_stats > B_stats:
		return 'A'
	elif B_stats > A_stats:
		return 'B'
	else:
		return 'A'
for i in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	x = better_player(r1, w1, c1, r2, w2, c2)
	print(x)


for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	acount = 0
	bcount = 0
	if a[0] > b[0]:
		acount += 1
	else:
		bcount += 1
	if a[1] > b[1]:
		acount += 1
	else:
		bcount += 1
	if a[2] > b[2]:
		acount += 1
	else:
		bcount += 1
	if acount > bcount:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	scoreA = 0
	scoreB = 0
	for i in range(3):
		if a[i] > b[i]:
			scoreA += 1
		else:
			scoreB += 1
	if scoreA > scoreB:
		print('A')
	else:
		print('B')


Test = int(input())
for Cases in range(Test):
	(P1Runs, P1Wickets, P1Catches) = map(int, input().split())
	(P2Runs, P2Wickets, P2Catches) = map(int, input().split())
	PlayerOneCount = 0
	PlayerTwoCount = 0
	if P1Runs > P2Runs:
		PlayerOneCount += 1
	else:
		PlayerTwoCount += 1
	if P1Wickets > P2Wickets:
		PlayerOneCount += 1
	else:
		PlayerTwoCount += 1
	if P1Catches > P2Catches:
		PlayerOneCount += 1
	else:
		PlayerTwoCount += 1
	if PlayerOneCount > PlayerTwoCount:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	c = 0
	for i in range(3):
		if a[i] > b[i]:
			c = c + 1
		else:
			c = c - 1
	if c > 0:
		print('A')
	else:
		print('B')


t = int(input())
while t > 0:
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	i = 0
	flag = 0
	for i in range(3):
		if a[i] > b[i]:
			flag += 1
		i += 1
	if flag >= 2:
		print('A')
	else:
		print('B')
	t -= 1


for i in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	(a1, b1) = (0, 0)
	for i in range(len(a)):
		if a[i] > b[i]:
			a1 += 1
		elif a[i] < b[i]:
			b1 += 1
	if a1 > b1:
		print('A')
	else:
		print('B')


t = int(input())
for i in range(t):
	(a1, a2, a3) = map(int, input().split())
	(b1, b2, b3) = map(int, input().split())
	count1 = 0
	count2 = 0
	if a1 > b1:
		count1 += 1
	else:
		count2 += 1
	if a2 > b2:
		count1 += 1
	else:
		count2 += 1
	if a3 > b3:
		count1 += 1
	else:
		count2 += 1
	if count1 > count2:
		print('A')
	else:
		print('B')


for test in range(int(input())):
	(R1, W1, C1) = map(int, input().split())
	(R2, W2, C2) = map(int, input().split())
	if R1 > R2 and W1 > W2:
		print('A')
	elif R1 > R2 and C1 > C2:
		print('A')
	elif W1 > W2 and C1 > C2:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	a = list(map(int, input().split()))
	b = list(map(int, input().split()))
	count = 0
	for i in range(3):
		if a[i] > b[i]:
			count = count + 1
	if count >= 2:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	(ca, cb) = (0, 0)
	a = [int(i) for i in input().split()]
	b = [int(i) for i in input().split()]
	for i in range(3):
		if a[i] > b[i]:
			ca += 1
		else:
			cb += 1
	print('A') if ca > cb else print('B')


t = int(input())
for i in range(0, t):
	l = list(map(int, input().split(' ')))
	m = list(map(int, input().split(' ')))
	c = 0
	d = 0
	for i in range(0, len(l)):
		if l[i] > m[i]:
			c += 1
		else:
			d += 1
	if c > d:
		print('A')
	else:
		print('B')


for _ in range(int(input())):
	(r1, w1, c1) = map(int, input().split())
	(r2, w2, c2) = map(int, input().split())
	a = 0
	b = 0
	if r1 > r2:
		a += 1
	else:
		b += 1
	if w1 > w2:
		a += 1
	else:
		b += 1
	if c1 > c2:
		a += 1
	else:
		b += 1
	print('A') if a > b else print('B')


for _ in range(int(input())):
	(x, y, z) = map(int, input().split())
	(a, b, c) = map(int, input().split())
	c1 = c2 = 0
	if x > a:
		c1 += 1
	else:
		c2 += 1
	if y > b:
		c1 += 1
	else:
		c2 += 1
	if z > c:
		c1 += 1
	else:
		c2 += 1
	if c1 > c2:
		print('A')
	else:
		print('B')


T = int(input())
for t in range(0, T):
	stats_a = list(map(int, input().split()))
	stats_b = list(map(int, input().split()))
	tally = 0
	for (a, b) in zip(stats_a, stats_b):
		if a > b:
			tally += 1
		else:
			tally -= 1
	if tally > 0:
		print('A')
	else:
		print('B')


for i in range(int(input())):
	(a, b) = (0, 0)
	l = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	for x in range(len(l)):
		if l[x] > l1[x]:
			a += 1
		elif l[x] < l1[x]:
			b += 1
	if a > b:
		print('A')
	else:
		print('B')