Alice and Bob play a game. Alice has $n$ cards, the $i$-th of them has the integer $a_i$ written on it. Bob has $m$ cards, the $j$-th of them has the integer $b_j$ written on it.

On the first turn of the game, the first player chooses one of his/her cards and puts it on the table (plays it). On the second turn, the second player chooses one of his/her cards such that the integer on it is greater than the integer on the card played on the first turn, and plays it. On the third turn, the first player chooses one of his/her cards such that the integer on it is greater than the integer on the card played on the second turn, and plays it, and so on — the players take turns, and each player has to choose one of his/her cards with greater integer than the card played by the other player on the last turn.

If some player cannot make a turn, he/she loses.

For example, if Alice has $4$ cards with numbers $[10, 5, 3, 8]$, and Bob has $3$ cards with numbers $[6, 11, 6]$, the game may go as follows:

Alice can choose any of her cards. She chooses the card with integer $5$ and plays it.

Bob can choose any of his cards with number greater than $5$. He chooses a card with integer $6$ and plays it.

Alice can choose any of her cards with number greater than $6$. She chooses the card with integer $10$ and plays it.

Bob can choose any of his cards with number greater than $10$. He chooses a card with integer $11$ and plays it.

Alice can choose any of her cards with number greater than $11$, but she has no such cards, so she loses.

Both Alice and Bob play optimally (if a player is able to win the game no matter how the other player plays, the former player will definitely win the game).

You have to answer two questions:

who wins if Alice is the first player?

who wins if Bob is the first player?


-----Input-----

The first line contains one integer $t$ ($1 \le t \le 1000$) — the number of test cases. Each test case consists of four lines.

The first line of a test case contains one integer $n$ ($1 \le n \le 50$) — the number of cards Alice has.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 50$) — the numbers written on the cards that Alice has.

The third line contains one integer $m$ ($1 \le m \le 50$) — the number of Bob's cards.

The fourth line contains $m$ integers $b_1, b_2, \dots, b_m$ ($1 \le b_i \le 50$) — the numbers on Bob's cards.


-----Output-----

For each test case, print two lines. The first line should be Alice if Alice wins when she is the first player; otherwise, the first line should be Bob. The second line should contain the name of the winner if Bob is the first player, in the same format.


-----Examples-----

Input
4
1
6
2
6 8
4
1 3 3 7
2
4 2
1
50
2
25 50
10
1 2 3 4 5 6 7 8 9 10
2
5 15
Output
Bob
Bob
Alice
Alice
Alice
Bob
Bob
Bob


-----Note-----

Let's consider the first test case of the example.

Alice has one card with integer $6$, Bob has two cards with numbers $[6, 8]$.

If Alice is the first player, she has to play the card with number $6$. Bob then has to play the card with number $8$. Alice has no cards left, so she loses.

If Bob is the first player, then no matter which of his cards he chooses on the first turn, Alice won't be able to play her card on the second turn, so she will lose.

Difficulty: EASY

Solutions:
def solve():
	n = int(input())
	a = map(int, input().split())
	m = int(input())
	b = map(int, input().split())
	ma = max(a)
	mb = max(b)
	print('Alice' if ma >= mb else 'Bob')
	print('Bob' if mb >= ma else 'Alice')
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	nnnn = int(input())
	lis1 = list(map(int, input().split()))
	mmmm = int(input())
	lis2 = list(map(int, input().split()))
	mx1 = max(lis1)
	mx2 = max(lis2)
	if mx1 == mx2:
		print('Alice')
		print('Bob')
	elif mx1 > mx2:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	A = sorted(list(map(int, input().split())))
	m = int(input())
	B = sorted(list(map(int, input().split())))
	flag = False
	if A[-1] > B[-1]:
		print('Alice')
		print('Alice')
		flag = True
	if B[-1] > A[-1]:
		print('Bob')
		print('Bob')
		flag = True
	if not flag:
		print('Alice')
		print('Bob')


for _ in range(int(input())):
	alicesize = int(input())
	alice = list(map(int, input().split()))
	bobsize = int(input())
	bob = list(map(int, input().split()))
	a = max(alice)
	b = max(bob)
	if a > b:
		print('Alice')
		print('Alice')
	elif b > a:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


n = int(input())
for i in range(n):
	x = int(input())
	y = list(map(int, input().split()))
	z = int(input())
	a = list(map(int, input().split()))
	if max(y) == max(a):
		print('Alice')
		print('Bob')
	elif max(y) > max(a):
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


import os.path
from math import gcd, floor, ceil
from collections import *
import sys
mod = 1000000007
INF = float('inf')

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

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

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

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

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

def prl(n):
	return sys.stdout.write(str(n) + ' ')
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = inp()
for i in range(t):
	n1 = inp()
	a = li()
	n2 = inp()
	b = li()
	m1 = max(a)
	m2 = max(b)
	if m1 > m2:
		print('Alice')
		print('Alice')
	elif m2 > m1:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
for i in range(t):
	n = int(input())
	arr = input().split()
	arr = list(map(int, arr))
	arr.sort()
	m = int(input())
	brr = input().split()
	brr = list(map(int, brr))
	brr.sort()
	if arr[-1] > brr[-1]:
		print('Alice\nAlice')
	elif arr[-1] < brr[-1]:
		print('Bob\nBob')
	else:
		print('Alice\nBob')


for tc in range(int(input())):
	ans1 = ans2 = ''
	n = int(input())
	alice = list(map(int, input().split()))
	m = int(input())
	bob = list(map(int, input().split()))
	mxm1 = max(alice)
	mxm2 = max(bob)
	if mxm1 > mxm2:
		ans1 = 'Alice'
		ans2 = 'Alice'
	if mxm2 > mxm1:
		ans1 = 'Bob'
		ans2 = 'Bob'
	if mxm1 == mxm2:
		ans1 = 'Alice'
		ans2 = 'Bob'
	print(ans1)
	print(ans2)


for t in range(int(input())):
	len1 = int(input())
	Alice = list(map(int, input().split()))
	len2 = int(input())
	Bob = list(map(int, input().split()))
	if max(Alice) < max(Bob):
		print('Bob')
		print('Bob')
	elif max(Alice) > max(Bob):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


def func(a, b):
	max_a = max(a)
	max_b = max(b)
	if max_a == max_b:
		return ['Alice', 'Bob']
	if max_a > max_b:
		return ['Alice', 'Alice']
	if max_a < max_b:
		return ['Bob', 'Bob']
output = []
for _ in range(int(input())):
	n = int(input())
	A = map(int, input().split())
	m = int(input())
	B = map(int, input().split())
	output.append(func(A, B))
for _ in output:
	for elem in _:
		print(elem)


t = int(input())
while t:
	n = int(input())
	alice = list(map(int, input().split()))
	m = int(input())
	bob = list(map(int, input().split()))
	a_m = max(alice)
	b_m = max(bob)
	if a_m == b_m:
		print('Alice')
		print('Bob')
	elif a_m > b_m:
		print('Alice')
		print('Alice')
	elif a_m < b_m:
		print('Bob')
		print('Bob')
	t -= 1


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	ll = list(map(int, input().split()))
	if max(ll) > max(l):
		print('Bob')
		print('Bob')
	elif max(l) > max(ll):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	alicia = list(map(int, input().split()))
	m = int(input())
	bob = list(map(int, input().split()))
	if max(alicia) >= max(bob):
		print('Alice')
	else:
		print('Bob')
	if max(alicia) > max(bob):
		print('Alice')
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	a = max(map(int, input().split()))
	m = int(input())
	b = max(map(int, input().split()))
	print('Alice' if a >= b else 'Bob')
	print('Alice' if a > b else 'Bob')


testCases = int(input())
for x in range(testCases):
	aliceCardsN = int(input())
	aliceCards = list(map(int, input().split()))
	bobCardsN = int(input())
	bobCards = list(map(int, input().split()))
	if max(bobCards) > max(aliceCards):
		print('Bob\nBob')
	if max(aliceCards) > max(bobCards):
		print('Alice\nAlice')
	if max(bobCards) == max(aliceCards):
		print('Alice\nBob')


tests = int(input())
for it in range(tests):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	am = max(a)
	bm = max(b)
	if am == bm:
		print('Alice')
		print('Bob')
	elif am > bm:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	m = int(input())
	b = [int(i) for i in input().split()]
	aa = max(a)
	bb = max(b)
	if aa > bb:
		print('Alice', 'Alice', sep='\n')
	elif bb > aa:
		print('Bob', 'Bob', sep='\n')
	else:
		print('Alice', 'Bob', sep='\n')


s = int(input())
for _ in range(s):
	temp = int(input())
	alice = [int(x) for x in input().split(' ')]
	temp = int(input())
	bob = [int(x) for x in input().split(' ')]
	if max(alice) >= max(bob):
		print('Alice')
	else:
		print('Bob')
	if max(alice) > max(bob):
		print('Alice')
	else:
		print('Bob')


t = int(input())
for i in range(t):
	a = int(input())
	ka = list(map(int, input().split()))
	b = int(input())
	kb = list(map(int, input().split()))
	maxa = max(ka)
	maxb = max(kb)
	if maxa == maxb:
		print('Alice')
		print('Bob')
	elif maxa > maxb:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


T = int(input())
for _ in range(T):
	N = int(input())
	A = map(int, input().split())
	M = int(input())
	B = map(int, input().split())
	maxA = max(A)
	maxB = max(B)
	if maxA > maxB:
		print('Alice')
		print('Alice')
	elif maxA < maxB:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(N, A) = (int(input()), list(map(int, input().split())))
	(M, B) = (int(input()), list(map(int, input().split())))
	if max(A) >= max(B):
		print('Alice')
	else:
		print('Bob')
	if max(B) >= max(A):
		print('Bob')
	else:
		print('Alice')


def solve():
	m = int(input())
	arr1 = list(map(int, input().split()))
	n = int(input())
	arr2 = list(map(int, input().split()))
	if max(arr1) > max(arr2):
		print('Alice')
		print('Alice')
	elif max(arr2) > max(arr1):
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')
for i in range(int(input())):
	solve()


for t in range(int(input())):
	n = int(input())
	nd = [int(i) for i in input().split()]
	m = int(input())
	md = [int(i) for i in input().split()]
	nmax = max(nd)
	mmax = max(md)
	if nmax == mmax:
		print('Alice')
		print('Bob')
	elif nmax > mmax:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().strip().split()))
	m = int(input())
	b = list(map(int, input().strip().split()))
	mx1 = max(a)
	mx2 = max(b)
	if mx1 > mx2:
		print('Alice')
		print('Alice')
	elif mx2 > mx1:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


from sys import stdin
from math import log, floor, ceil, gcd
input = stdin.readline
inp = lambda : int(stdin.readline())

def ra(typ):
	return list(map(typ, stdin.readline().split()))

def rv(typ):
	return map(typ, stdin.readline().split())

def main():
	for _ in range(inp()):
		n = inp()
		a = ra(int)
		m = inp()
		b = ra(int)
		m1 = max(a)
		m2 = max(b)
		if m1 > m2:
			print('Alice')
			print('Alice')
		elif m2 > m1:
			print('Bob')
			print('Bob')
		else:
			print('Alice')
			print('Bob')
main()


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	x = int(input())
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	if max(a) > max(b):
		print('Alice')
		print('Alice')
	elif max(a) == max(b):
		print('Alice')
		print('Bob')
	else:
		print('Bob')
		print('Bob')
	t -= 1


t = int(input())
for tc in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	if max(b) > max(a):
		print('Bob')
		print('Bob')
	elif max(a) > max(b):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


def solve():
	n = int(input())
	a = list(map(int, input().split(' ')))
	m = int(input())
	b = list(map(int, input().split(' ')))
	ma = -1
	for ele in a:
		if ele > ma:
			ma = ele
	mb = -1
	for ele in b:
		if ele > mb:
			mb = ele
	if ma > mb:
		print('Alice')
		print('Alice')
	elif ma < mb:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	ma = max(a)
	mb = max(b)
	if ma >= mb:
		print('Alice')
	else:
		print('Bob')
	if mb >= ma:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	max_a = max(a)
	max_b = max(b)
	if max_a > max_b:
		print('Alice')
		print('Alice')
	elif max_b > max_a:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	d = int(input())
	y = list(map(int, input().split()))
	o = max(x)
	i = max(y)
	if o > i:
		print('Alice')
		print('Alice')
	elif i > o:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
while t:
	n1 = int(input())
	a = list(map(int, input().split(' ')))
	maxx1 = max(a)
	n2 = int(input())
	b = list(map(int, input().split(' ')))
	maxx2 = max(b)
	if maxx1 > maxx2:
		print('Alice')
		print('Alice')
	elif maxx2 > maxx1:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	alice = max(list(map(int, input().split())))
	m = int(input())
	bob = max(list(map(int, input().split())))
	if alice > bob:
		print('Alice')
		print('Alice')
	elif bob > alice:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	g1 = max(a)
	g2 = max(b)
	if g1 >= g2:
		print('Alice')
	else:
		print('Bob')
	if g2 >= g1:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for _ in range(t):
	na = int(input())
	la = [int(x) for x in input().split()]
	nb = int(input())
	lb = [int(x) for x in input().split()]
	if max(lb) > max(la):
		print('Bob')
		print('Bob')
	elif max(lb) < max(la):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


n = int(input())
for i in range(n):
	Calice = int(input())
	a = input().split()
	a = [int(a[j]) for j in range(Calice)]
	Cbob = int(input())
	b = input().split()
	b = [int(b[j]) for j in range(Cbob)]
	bmax = max(b)
	amax = max(a)
	if bmax > amax:
		print('Bob')
	elif bmax < amax:
		print('Alice')
	else:
		print('Alice')
	if bmax > amax:
		print('Bob')
	elif bmax < amax:
		print('Alice')
	else:
		print('Bob')


t = input()
end_result = ''
for i in range(int(t)):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	max_a = max(a)
	max_b = max(b)
	end_result += ('Alice' if max_a >= max_b else 'Bob') + '\n' + ('Bob' if max_b >= max_a else 'Alice') + '\n'
print(end_result[:-1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	ma = max(a)
	mb = max(b)
	if ma > mb:
		print('Alice')
		print('Alice')
	elif ma < mb:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


for i in range(int(input())):
	n = int(input())
	an = sorted(list(map(int, input().split())))
	m = int(input())
	am = sorted(list(map(int, input().split())))
	x = max(an)
	y = max(am)
	if x == y:
		print('Alice')
		print('Bob')
	elif x < y:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Alice')


for _ in range(int(input())):
	alice = int(input())
	alice_arr = list(map(int, input().split()))
	bob = int(input())
	bob_arr = list(map(int, input().split()))
	maks_alice = max(alice_arr)
	maks_bob = max(bob_arr)
	if maks_alice > maks_bob:
		print('Alice')
		print('Alice')
	elif maks_bob > maks_alice:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


for i in range(int(input())):
	a = int(input())
	al = list(map(int, input().split()))
	b = int(input())
	bl = list(map(int, input().split()))
	if max(al) > max(bl):
		print('Alice')
		print('Alice')
	elif max(bl) > max(al):
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	d = int(input())
	e = list(map(int, input().split()))
	if max(c) < max(e):
		print('Bob')
	elif max(c) == max(e):
		print('Alice')
	else:
		print('Alice')
	if max(c) > max(e):
		print('Alice')
	elif max(c) == max(e):
		print('Bob')
	else:
		print('Bob')


for _ in range(int(input())):
	input()
	A = max(map(int, input().split()))
	input()
	B = max(map(int, input().split()))
	if A > B:
		print('Alice')
		print('Alice')
	elif A < B:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	c = int(input())
	d = list(map(int, input().split()))
	if max(b) >= max(d):
		print('Alice')
	else:
		print('Bob')
	if max(d) >= max(b):
		print('Bob')
	else:
		print('Alice')


t = int(input())
for x in range(t):
	n = int(input())
	ai = list(map(int, input().split()))
	m = int(input())
	pi = list(map(int, input().split()))
	if max(ai) > max(pi):
		print('Alice')
		print('Alice')
	elif max(ai) < max(pi):
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
while t:
	t -= 1
	m = int(input())
	x = list(map(int, input().split()))
	n = int(input())
	y = list(map(int, input().split()))
	p = max(x)
	q = max(y)
	if p > q:
		print('Alice')
		print('Alice')
	elif q > p:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
for i in range(t):
	a = int(input())
	arr1 = list(map(int, input().split()))
	b = int(input())
	arr2 = list(map(int, input().split()))
	al = max(arr1)
	bo = max(arr2)
	if a == 0:
		print('Bob')
		print('Bob')
		continue
	elif b == 0:
		print('Alice')
		print('Alice')
		continue
	elif al == bo:
		print('Alice')
		print('Bob')
	elif al > bo:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


for i in range(int(input())):
	allice = int(input())
	a = list(map(int, input().split()))
	bob = int(input())
	b = list(map(int, input().split()))
	c = max(a)
	d = max(b)
	if c >= d:
		print('Alice')
	else:
		print('Bob')
	if c <= d:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	maxa = max(a)
	maxb = max(b)
	if maxa > maxb:
		print('Alice\nAlice')
	elif maxa < maxb:
		print('Bob\nBob')
	else:
		print('Alice\nBob')


T = int(input())
for i in range(T):
	Na = int(input())
	a = list(map(int, input().split()))
	Nb = int(input())
	b = list(map(int, input().split()))
	if max(a) != max(b):
		if max(a) > max(b):
			print('Alice')
			print('Alice')
		elif max(b) > max(a):
			print('Bob')
			print('Bob')
	else:
		print('Alice')
		print('Bob')


for _ in range(int(input())):
	a = int(input())
	l1 = list(map(int, input().split()))
	m1 = max(l1)
	b = int(input())
	l2 = list(map(int, input().split()))
	m2 = max(l2)
	t1 = t2 = ''
	if m1 > m2:
		t1 = 'Alice'
	elif m1 == m2:
		t1 = 'Alice'
	else:
		t1 = 'Bob'
	print(t1)
	if m1 > m2:
		t2 = 'Alice'
	elif m1 == m2:
		t2 = 'Bob'
	else:
		t2 = 'Bob'
	print(t2)


def firstAlice(alicel, bobl):
	if max(alicel) < max(bobl):
		print('Bob')
	else:
		print('Alice')

def firstBob(alicel, bob):
	if max(alicel) > max(bobl):
		print('Alice')
	else:
		print('Bob')
test = int(input())
for i in range(test):
	alice = int(input())
	alicel = list(map(int, input().split()))
	bob = int(input())
	bobl = list(map(int, input().split()))
	firstAlice(alicel, bobl)
	firstBob(alicel, bobl)


import sys
T = int(sys.stdin.readline().rstrip())
for t in range(T):
	N = int(sys.stdin.readline().rstrip())
	A = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	M = int(sys.stdin.readline().rstrip())
	B = list(map(int, sys.stdin.readline().rstrip().split(' ')))
	names = {True: 'Alice', False: 'Bob'}
	max_A = max(A)
	max_B = max(B)
	len_A = len(A)
	len_B = len(B)
	for first in [True, False]:
		if max_A == max_B:
			print(names[first])
		else:
			print(names[max_A > max_B])


for _ in range(int(input())):
	n = int(input())
	n_1 = [int(i) for i in input().split()]
	m = int(input())
	m_1 = [int(i) for i in input().split()]
	if max(n_1) > max(m_1):
		print('Alice')
		print('Alice')
	elif max(n_1) == max(m_1):
		print('Alice')
		print('Bob')
	else:
		print('Bob')
		print('Bob')


for i in range(int(input())):
	x = int(input())
	xl = list(map(int, input().split()))
	y = int(input())
	yl = list(map(int, input().split()))
	mxl = max(xl)
	myl = max(yl)
	if mxl > myl:
		print('Alice')
		print('Alice')
	elif myl > mxl:
		print('Bob')
		print('Bob')
	else:
		print('Alice')
		print('Bob')


t = int(input())
while t > 0:
	t -= 1
	no_of_card_alice = int(input())
	arr_of_alice_cards = list(map(int, input().split()))
	arr_of_alice_cards.sort()
	no_of_card_bob = int(input())
	arr_of_bob_cards = list(map(int, input().split()))
	arr_of_bob_cards.sort()
	if arr_of_alice_cards[no_of_card_alice - 1] == 50 or arr_of_alice_cards[no_of_card_alice - 1] == arr_of_bob_cards[no_of_card_bob - 1]:
		print('Alice')
	elif arr_of_alice_cards[no_of_card_alice - 1] > arr_of_bob_cards[no_of_card_bob - 1]:
		print('Alice')
	else:
		print('Bob')
	if arr_of_bob_cards[no_of_card_bob - 1] == 50 or arr_of_alice_cards[no_of_card_alice - 1] == arr_of_bob_cards[no_of_card_bob - 1]:
		print('Bob')
	elif arr_of_alice_cards[no_of_card_alice - 1] > arr_of_bob_cards[no_of_card_bob - 1]:
		print('Alice')
	else:
		print('Bob')


for q in range(int(input())):
	lon1 = int(input())
	alc = list(map(int, input().split()))
	lon2 = int(input())
	bb = list(map(int, input().split()))
	m_a = max(alc)
	m_b = max(bb)
	if m_a < m_b:
		print('Bob')
		print('Bob')
	elif m_a > m_b:
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	c = 1
	if c == 1:
		if max(b) > max(a):
			print('Bob')
		else:
			print('Alice')
	if c == 1:
		if max(a) > max(b):
			print('Alice')
		else:
			print('Bob')


for t in range(int(input())):
	k1 = int(input())
	a_arr = list(map(int, input().split()))
	k2 = int(input())
	b_arr = list(map(int, input().split()))
	if max(a_arr) < max(b_arr):
		print('Bob')
		print('Bob')
	elif max(a_arr) > max(b_arr):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


for t in range(int(input())):
	length1 = int(input())
	Alice_arr = list(map(int, input().split()))
	length2 = int(input())
	Bob_arr = list(map(int, input().split()))
	if max(Alice_arr) < max(Bob_arr):
		print('Bob')
		print('Bob')
	elif max(Alice_arr) > max(Bob_arr):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


import sys
for _ in range(int(sys.stdin.readline())):
	n1 = int(sys.stdin.readline())
	lst1 = list(map(int, sys.stdin.readline().strip().split()))
	n2 = int(sys.stdin.readline())
	lst2 = list(map(int, sys.stdin.readline().strip().split()))
	flag = 0
	if max(lst1) < max(lst2):
		print('Bob')
		print('Bob')
	elif max(lst1) > max(lst2):
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


for i in range(int(input())):
	a = int(input())
	l1 = list(map(int, input().split()))
	b = int(input())
	l2 = list(map(int, input().split()))
	m1 = max(l1)
	m2 = max(l2)
	m3 = max(m1, m2)
	if m3 in l1:
		print('Alice')
		if m3 in l2:
			print('Bob')
		else:
			print('Alice')
	if m3 in l2 and m3 not in l1:
		print('Bob')
		if m3 in l1:
			print('Alice')
		else:
			print('Bob')


for i in range(int(input())):
	l = input()
	al = list(map(int, input().split()))
	b = input()
	bo = list(map(int, input().split()))
	al.sort()
	bo.sort()
	if bo[-1] <= al[-1]:
		print('Alice')
	else:
		print('Bob')
	if al[-1] <= bo[-1]:
		print('Bob')
	else:
		print('Alice')


test = int(input())
for t in range(test):
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	alice = max(a)
	bob = max(b)
	if alice == bob:
		print('Alice')
		print('Bob')
	elif alice > bob:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


for i in range(int(input())):
	n = int(input())
	a = max([int(i) for i in input().split()])
	m = int(input())
	b = max([int(i) for i in input().split()])
	if a > b:
		print('Alice')
		print('Alice')
	elif a == b:
		print('Alice')
		print('Bob')
	else:
		print('Bob')
		print('Bob')


for i in range(int(input())):
	m = 0
	n = 0
	input()
	m = max(map(int, input().split()))
	input()
	n = max(map(int, input().split()))
	print('Alice\nAlice' if m > n else 'Bob\nBob' if n > m else 'Alice\nBob')


for _ in range(int(input())):
	n = int(input())
	nlist = list(map(int, input().split()))
	m = int(input())
	mlist = list(map(int, input().split()))
	nmax = max(nlist)
	mmax = max(mlist)
	if nmax == mmax:
		print('Alice')
		print('Bob')
	elif nmax > mmax:
		print('Alice')
		print('Alice')
	else:
		print('Bob')
		print('Bob')


for _ in range(int(input())):
	input()
	f = list(map(int, input().split()))
	input()
	m = list(map(int, input().split()))
	print('Alice' if max(f) >= max(m) else 'Bob')
	print('Alice' if max(f) > max(m) else 'Bob')


n = int(input())
for i in range(n):
	input()
	f = list(map(int, input().split()))
	input()
	m = list(map(int, input().split()))
	print('Alice' if max(f) >= max(m) else 'Bob')
	print('Alice' if max(f) > max(m) else 'Bob')


for _ in range(int(input())):
	nA = int(input())
	A = list(map(int, input().split()))
	nB = int(input())
	B = list(map(int, input().split()))
	print('Alice\nAlice' if max(A) > max(B) else 'Bob\nBob' if max(B) > max(A) else 'Alice\nBob')


for _ in range(int(input())):
	input()
	a = list(map(int, input().split()))
	input()
	b = list(map(int, input().split()))
	print(['Bob', 'Alice'][max(a) >= max(b)])
	print(['Bob', 'Alice'][max(a) > max(b)])


t = int(input())
while t > 0:
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	m = int(input())
	b = [int(i) for i in input().split(' ')]
	maxA = max(a)
	maxB = max(b)
	if maxA > maxB:
		print('Alice\nAlice')
	elif maxA < maxB:
		print('Bob\nBob')
	else:
		print('Alice\nBob')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	lst1 = list(map(int, input().split()))
	m = int(input())
	lst2 = list(map(int, input().split()))
	if max(lst1) >= max(lst2):
		print('Alice')
	else:
		print('Bob')
	if max(lst1) <= max(lst2):
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	a = int(input())
	max_a = max(map(int, input().split()))
	b = int(input())
	max_b = max(map(int, input().split()))
	print('Alice\nAlice' if max_a > max_b else 'Bob\nBob' if max_b > max_a else 'Alice\nBob')


p = int(input())
while p:
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	x = a[n - 1]
	y = b[m - 1]
	if y > x:
		print('Bob')
	else:
		print('Alice')
	if x > y:
		print('Alice')
	else:
		print('Bob')
	p -= 1


for i in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	m = int(input())
	lis2 = list(map(int, input().split()))
	m1 = max(lis)
	m2 = max(lis2)
	if m1 < m2:
		print('Bob')
		print('Bob')
	elif m1 > m2:
		print('Alice')
		print('Alice')
	else:
		print('Alice')
		print('Bob')


for _ in range(int(input())):
	A_kol = int(input())
	A_nom = [int(a) for a in input().split()]
	B_kol = int(input())
	B_nom = [int(b) for b in input().split()]
	A_max = max(A_nom)
	B_max = max(B_nom)
	if A_max > B_max:
		print('Alice')
		print('Alice')
	elif A_max < B_max:
		print('Bob')
		print('Bob')
	elif A_max == B_max:
		print('Alice')
		print('Bob')


rounds = int(input())
while rounds:
	num = int(input())
	product = str(0)
	while num:
		n = map(int, input().split())
		product = max(product and n)
		num = 0
	num2 = int(input())
	product2 = str(0)
	while num2:
		n2 = map(int, input().split())
		product2 = max(product2 and n2)
		num2 = 0
	if product > product2:
		print('Alice\nAlice')
	elif product2 > product:
		print('Bob\nBob')
	else:
		print('Alice\nBob')
	rounds -= 1


n = int(input())
for g in range(n):
	contadorAlice = int(input())
	alice = list(map(int, input().split()))
	contadorBob = int(input())
	bob = list(map(int, input().split()))
	m1 = max(alice)
	m2 = max(bob)
	if m1 < m2:
		print('Bob')
	elif m1 >= m2:
		print('Alice')
	if m2 < m1:
		print('Alice')
	elif m2 >= m1:
		print('Bob')