Alice and Bob are playing a game. Alice goes first.

They have a binary circular array A with N elements. In one move, a player can:
Choose a *circular continuous segment* of the array and perform a *left cyclic shift* on the chosen segment.

We define the term diff(A) as the number of pairs of adjacent elements with different values.
Note that we also consider A_{N} and A_{1} as adjacent.

A player can make a move only if, for the updated array A', diff(A')> diff(A).

The player who is unable to make a move, loses. Find the winner of the game if both players play optimally.

Note:
For an array A with N elements, some *circular continuous segments* are [A_{1}], [A_{1}, A_{2}, A_{3}], [A_{N-1}, A_{N}, A_{1}, A_{2}], etc.
A *left cyclic shift* of a segment [A_{1}, A_{2}, A_{3}] is [A_{2}, A_{3}, A_{1}]. Similarly, *left cyclic shift* of segment [A_{N-1}, A_{N}, A_{1}, A_{2}] is [A_{N}, A_{1}, A_{2}, A_{N-1}].

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

- The first line of input contains a single integer T, the number of test cases. The description of the test cases follows.
- Each test cases consists of two lines of input.
- The first line of each test case contains a single integer N, the number of elements.
- The second line of each test case contains N space-separated integers A_{1},A_{2}, \ldots, A_{N}.

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

For each test case, if Alice will win print Alice, otherwise print Bob.

You may print each character in Uppercase or Lowercase. For example: BOB, bob, boB, and Bob are all identical.

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

$1 ≤ T ≤ 100$
$1 ≤ N ≤ 10^{6}$
$0 ≤ A_{i} ≤ 1$
- The sum of $N$ over all test cases won't exceed $10^{6}$.

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

None

----- Sample Input 1 ------ 
3
3
1 0 1
4
1 1 0 0
8
1 0 1 0 0 0 1 1

----- Sample Output 1 ------ 
Bob
Alice
Bob
----- explanation 1 ------ 
Test case $1$: Alice can not perform any move. Thus, Bob wins.

Test case $2$: Alice can perform the following move:
- Choose the segment $[A_{1},A_{2},A_{3}]$ and perform *left cyclic shift*. Thus, $A$ becomes $[1,0,1,0]$.  
Also, $diff([1, 1, 0, 0]) = 2$ as pairs of adjacent elements with different values are $(A_{2}, A_{3})$ and $(A_{4}, A_{1})$. After this move, $diff([1, 0, 1, 0]) = 4$ as all pairs of adjacent elements have different values. Since $diff([1, 0, 1, 0]) > diff([1, 1, 0, 0])$, this move is valid.

After performing the move, Bob has no valid move left. Thus, Alice wins.

Difficulty: MEDIUM_HARD
Tags: Game theory

Starter code:

Solutions:
for _ in range(int(input())):
	N = int(input())
	S = list(map(int, input().split()))
	(ones, zeros) = (0, 0)
	isone = False
	iszero = False
	i = 1
	while i < N:
		if S[i] == '1':
			isone = True
		else:
			iszero = True
		tmp = 0
		if S[i] == S[i - 1]:
			while i < N and S[i] == S[i - 1]:
				i += 1
				tmp += 1
			i -= 1
			if S[i] == 0:
				zeros += tmp
			else:
				ones += tmp
		i += 1
	if N > 2 and S[0] == S[-1]:
		if S[0] == 1:
			ones += 1
		else:
			zeros += 1
	if ones == 0 or zeros == 0:
		print('Bob')
		continue
	if min(ones, zeros) % 2:
		print('Alice')
	else:
		print('Bob')


for t in range(int(input())):
	n = int(input())
	s = input().split()
	o = z = 0
	for i in range(1, n):
		if s[i - 1] == s[i]:
			if s[i] == '1':
				o += 1
			else:
				z += 1
	if n > 1 and s[0] == s[-1]:
		if s[0] == '1':
			o += 1
		else:
			z += 1
	if min(o, z) % 2 == 1:
		print('Alice')
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	(a, b) = (0, 0)
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			if s[i] == 0:
				a += 1
			else:
				b += 1
	if s[0] == s[-1]:
		if s[0] == 0:
			a += 1
		else:
			b += 1
	count = min(a, b)
	print('Alice' if count % 2 else 'Bob')


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = 0
	b = 2 * min(l.count(0), l.count(1))
	for i in range(n):
		if l[i] != l[i - 1]:
			a += 1
	if (b - a) // 2 % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	l = int(input())
	m = [int(i) for i in input().split()]
	d = 0
	for i in range(l):
		if m[i - 1] != m[i]:
			d += 1
	s = sum(m)
	dm = min(s, len(m) - s) * 2
	rounds = (dm - d) // 2 + (dm - d) % 2
	print('Alice' if rounds % 2 else 'Bob')


n = int(input())
for z in range(n):
	size = int(input())
	arr = [int(i) for i in input().split()]
	zero = 0
	ones = 0
	for i in range(size - 1):
		if arr[i] == arr[i + 1]:
			if arr[i] == 0:
				zero += 1
			else:
				ones += 1
	if arr[0] == arr[-1]:
		if arr[0] == 0:
			zero += 1
		else:
			ones += 1
	count = min(zero, ones)
	if count % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	diff = 0
	for i in range(n):
		if a[i - 1] != a[i]:
			diff += 1
	sum_a = sum(a)
	diff_max = min(sum_a, len(a) - sum_a) * 2
	rounds = (diff_max - diff) // 2 + (diff_max - diff) % 2
	print('Alice' if rounds % 2 else 'Bob')


ans = []
for _ in range(int(input())):
	N = int(input())
	A = [int(x) for x in input().split()]
	(c0, c1) = (0, 0)
	for i in range(N):
		if A[i] != A[i - 1]:
			continue
		if A[i]:
			c1 += 1
		else:
			c0 += 1
	an = 'Alice' if min(c0, c1) % 2 else 'Bob'
	ans.append(an)
print(*ans, sep='\n')


t = int(input(''))
for case in range(t):
	N = int(input(''))
	A = input('').split(' ')
	for i in range(N):
		A[i] = int(A[i])
	extra0s = 0
	extra1s = 0
	for i in range(-1, N - 1):
		if A[i] == 0 and A[i + 1] == 0:
			extra0s += 1
		elif A[i] == 1 and A[i + 1] == 1:
			extra1s += 1
	moves = min(extra0s, extra1s) % 2
	if moves:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	res = 0
	if a[0] == a[-1]:
		if a[0] == 0:
			count += 1
		else:
			res += 1
	for i in range(len(a) - 1):
		if a[i] == a[i + 1]:
			if a[i] == 0:
				count += 1
			else:
				res += 1
	minimum = min(count, res)
	if minimum % 2 != 0:
		print('Alice')
	else:
		print('Bob')


def main():
	n = int(input())
	for i in range(n):
		size = int(input())
		test = [int(x) for x in input().split(' ')]
		solve(test)

def solve(test):
	paired_0s = 0
	paired_1s = 0
	for i in range(-1, len(test) - 1):
		if test[i] == test[i + 1]:
			if test[i] == 0:
				paired_0s = paired_0s + 1
			else:
				paired_1s = paired_1s + 1
	min_paired = min(paired_0s, paired_1s)
	if min_paired % 2 == 1:
		print('Alice')
	else:
		print('Bob')
main()


def solve(arr):
	if len(arr) <= 3:
		return 'Bob'
	count0 = 0
	count1 = 0
	if arr[0] == arr[-1]:
		if arr[0] == 0:
			count0 += 1
		else:
			count1 += 1
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1]:
			if arr[i] == 0:
				count0 += 1
			else:
				count1 += 1
	return 'Alice' if min(count0, count1) % 2 != 0 else 'Bob'
t = int(input())
arr = []
for i_ in range(t):
	d = int(input())
	arr.append([int(i) for i in input().split()])
for a in arr:
	print(solve(a))


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	v0 = 0
	v1 = 0
	if l[0] == l[-1]:
		if l[0] == 0:
			v0 += 1
		else:
			v1 += 1
	for i in range(0, n - 1):
		if l[i] == l[i + 1]:
			if l[i] == 0:
				v0 += 1
			else:
				v1 += 1
	jk = min(v0, v1)
	print('Alice' if jk % 2 != 0 else 'Bob')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = a.count(1)
	a0 = a.count(0)
	c = 0
	if a1 > a0:
		k = 0
	else:
		k = 1
	if a[0] == a[n - 1] and a[0] == k:
		c += 1
	for i in range(n - 1):
		if a[i] == a[i + 1] and a[i] == k:
			c += 1
	if c % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def solve(arr):
	if len(arr) <= 3:
		return 'Bob'
	count0 = 0
	count1 = 0
	if arr[0] == arr[-1]:
		if arr[0] == 0:
			count0 += 1
		else:
			count1 += 1
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1]:
			if arr[i] == 0:
				count0 += 1
			else:
				count1 += 1
	return 'Alice' if min(count0, count1) % 2 != 0 else 'Bob'
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	print(solve(a))


for i in range(int(input())):
	n = int(input())
	l = [int(x) for x in input().split()]
	c = [0, 0]
	if l[0] == l[-1]:
		c[l[0]] += 1
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			c[l[i]] += 1
	if min(c[0], c[1]) % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	o = 0
	z = 0
	for i in range(n):
		if s[i] == s[(i + 1) % n]:
			if s[i] == 1:
				o += 1
			else:
				z += 1
	mini = min(o, z)
	if not mini % 2:
		print('Bob')
	else:
		print('Alice')


t = int(input())
while t > 0:
	n = int(input())
	a = [int(x) for x in input().split()]
	cnt0 = 0
	cnt1 = 0
	for i in a:
		if i:
			cnt1 += 1
		else:
			cnt0 += 1
	mx = 2 * min(cnt0, cnt1)
	mn = 0
	for i in range(1, n):
		if a[i] != a[i - 1]:
			mn += 1
	if a[n - 1] != a[0]:
		mn += 1
	diff = (mx - mn) // 2
	print('Bob' if not diff % 2 else 'Alice')
	t -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	one = 0
	zero = 0
	for j in range(0, n):
		if j == n - 1:
			if a[0] == a[j] and a[j] == 1:
				one += 1
			elif a[0] == a[j] and a[j] == 0:
				zero += 1
		elif a[j] == a[j + 1] and a[j] == 0:
			zero += 1
		elif a[j] == a[j + 1] and a[j] == 1:
			one += 1
	ans = min(one, zero)
	if ans % 2 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cnt = [0, 0]
	if arr[0] == arr[n - 1]:
		cnt[arr[0]] += 1
	for i in range(n - 1):
		if arr[i] == arr[i + 1]:
			cnt[arr[i]] += 1
	ans = min(cnt[0], cnt[1])
	if ans % 2 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for i in range(t):
	n = int(input())
	arr1 = list(map(int, input().split()))
	count_one = arr1.count(1)
	count_zero = arr1.count(0)
	sum = 0
	for i in range(n):
		if i == 0:
			sum += arr1[0] == arr1[n - 1]
		else:
			sum += arr1[i] == arr1[i - 1]
	sum -= abs(count_zero - count_one)
	if sum % 4 == 0:
		print('Bob')
	else:
		print('Alice')


def alice_bob(arr1, size):
	count_one = arr1.count(1)
	count_zero = arr1.count(0)
	sum = 0
	for i in range(size):
		if i == 0:
			sum += arr1[0] == arr1[size - 1]
		else:
			sum += arr1[i] == arr1[i - 1]
	sum -= abs(count_zero - count_one)
	if sum % 4 == 0:
		return 'Bob'
	else:
		return 'Alice'
for _ in range(int(input())):
	size = int(input())
	arr1 = list(map(int, input().split()))
	ans = alice_bob(arr1, size)
	print(ans)


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	total_adjacent_no = 0
	no_of_zeros = a.count(0)
	no_of_ones = a.count(1)
	for j in range(n - 1):
		if a[j] == a[j + 1]:
			total_adjacent_no += 1
	if a[n - 1] == a[0]:
		total_adjacent_no += 1
	if (total_adjacent_no - abs(no_of_zeros - no_of_ones)) % 4:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if n == 1 or n == 2:
		print('Bob')
		continue
	c1 = sum(arr)
	c0 = n - c1
	pp = 2 * min(c0, c1)
	cnp = 0
	for i in range(n):
		if arr[i] != arr[(i + 1) % n]:
			cnp += 1
	ntp = (pp - cnp) // 2
	if ntp % 2:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for i in range(t):
	accept = int(input())
	array = list(map(int, input().split()))
	o = e = 0
	for j in range(len(array)):
		if array[j] == array[(j + 1) % accept]:
			if array[j] == 1:
				e += 1
			else:
				o += 1
	create = min(e, o)
	if create % 2 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for i in range(t):
	n = int(input())
	num = [int(x) for x in input().split()]
	diff = 0
	for j in range(1, n):
		if num[j - 1] != num[j]:
			diff += 1
	if num[0] != num[n - 1]:
		diff += 1
	max_c = 2 * min(num.count(0), num.count(1))
	moves = (max_c - diff) / 2
	if moves % 2 == 0:
		print('Bob')
	else:
		print('Alice')


testcases = int(input())
for eachcase in range(testcases):
	length = int(input())
	array = list(map(int, input().split()))
	initialcount = 0
	for index in range(length - 1):
		if array[index] != array[index + 1]:
			initialcount += 1
	if array[0] != array[length - 1]:
		initialcount += 1
	finalcount = 2 * min(array.count(0), array.count(1))
	parity = (finalcount - initialcount) // 2
	if parity & 1:
		print('Alice')
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c1 = 0
	c2 = 0
	for i in range(n):
		if a[i] == a[(i + 1) % n]:
			if a[i] == 0:
				c1 += 1
			else:
				c2 += 1
	d = min(c1, c2)
	if d % 2 == 1:
		print('Alice')
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	l = ''.join(map(str, x))
	l += l[0]
	c = l.count('01') + l.count('10')
	l = l[:-1]
	m = min(l.count('0'), l.count('1')) * 2
	print(['Bob', 'Alice'][(m - c) // 2 & 1])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	win = 0
	b = a.count(1)
	c = a.count(0)
	if b < c:
		d = 1
	else:
		d = 0
	for j in range(n - 1):
		if a[j] == a[j + 1] and a[j] == d:
			win += 1
	if a[0] == a[-1] and a[0] == d:
		win += 1
	if win & 1:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for test_cases in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	count = 0
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			count += 1
	if a[0] != a[-1]:
		count += 1
	zero = a.count(0)
	ones = a.count(1)
	maxm = 0
	if zero == ones:
		maxm = n
	else:
		maxm = 2 * min(zero, ones)
	noofsteps = int((maxm - count) / 2)
	if noofsteps % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	s0 = 0
	s1 = 0
	if a[0] == a[n - 1]:
		if a[0] == 0:
			s0 += 1
		else:
			s1 += 1
	for i in range(1, n):
		if a[i] == a[i - 1]:
			if a[i] == 0:
				s0 += 1
			else:
				s1 += 1
	if s0 >= s1 and s1 % 2 == 1:
		print('Alice')
	elif s0 >= s1 and s1 % 2 != 1:
		print('Bob')
	elif s0 % 2 == 1:
		print('Alice')
	else:
		print('Bob')


t = int(input())
while t > 0:
	n = int(input())
	l = list(map(int, input().split()))
	z = l.count(0)
	o = l.count(1)
	count = 0
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			count += 1
	if l[0] == l[-1]:
		count += 1
	if (count - abs(z - o)) % 4 == 0:
		print('Bob')
	else:
		print('Alice')
	t -= 1


T = int(input())
for t in range(T):
	n = int(input())
	s = input().split()
	a = [int(x) for x in s]
	ad_0 = 0
	ad_1 = 0
	count_1 = a.count(1)
	count_0 = a.count(0)
	for i in range(1, n):
		if a[i] == 1 and a[i - 1] == 1:
			ad_1 += 1
		if a[i] == 0 and a[i - 1] == 0:
			ad_0 += 1
	if a[0] == 1 and a[n - 1] == 1:
		ad_1 += 1
	if a[0] == 0 and a[n - 1] == 0:
		ad_0 += 1
	w = 0
	w = min(ad_0, ad_1)
	if w % 2 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	c0 = 0
	c1 = 0
	for i in range(n):
		if a[i] == a[(i + 1) % n]:
			if a[i] == 1:
				c1 = c1 + 1
			else:
				c0 = c0 + 1
	f = min(c0, c1)
	if f % 2 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())

def no_of_adjacents(l, x):
	num = 0
	if l[0] == l[-1] and l[0] == x:
		num += 1
	for i in range(len(l) - 1):
		if l[i] == l[i + 1] and l[i] == x:
			num += 1
	return num
for r in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	if n == 1 or n == 2:
		print('Bob')
	else:
		zeroes = l.count(0)
		ones = l.count(1)
		if zeroes < ones:
			x = 0
		else:
			x = 1
		a = no_of_adjacents(l, x)
		if a % 2 == 0:
			print('Bob')
		else:
			print('Alice')


for t in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	c = 0
	for i in range(1, n):
		if x[i] != x[i - 1]:
			c += 1
	if x[-1] != x[0]:
		c += 1
	y = 2 * min(x.count(0), x.count(1))
	if (y - c) // 2 % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for t in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	x = 0
	for i in range(1, n):
		if arr[i] != arr[i - 1]:
			x += 1
	if arr[-1] != arr[0]:
		x += 1
	(a, b) = (arr.count(0), arr.count(1))
	y = 2 * min(a, b)
	if (y - x) // 2 % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	a = input().replace(' ', '')
	ad = 0
	ad1 = a.count('0')
	ad0 = a.count('1')
	for j in range(n - 1):
		if a[j] == a[j + 1]:
			ad += 1
	if a[n - 1] == a[0]:
		ad += 1
	if (ad - abs(ad1 - ad0)) % 4:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for x in range(t):
	n = input()
	seq = list(map(int, input().split()))
	score = 0
	for i in range(int(n)):
		if seq[i] != seq[i - 1]:
			score = score + 1
	scoreMax = 2 * min(sum(seq), int(n) - sum(seq))
	moves = (scoreMax - score) // 2
	if moves % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	cnt = [0, 0]
	if a[0] == a[-1]:
		cnt[a[0]] += 1
	for i in range(n - 1):
		if a[i] == a[i + 1]:
			cnt[a[i]] += 1
	m = min(cnt)
	if m % 2 != 0:
		print('Alice')
	else:
		print('Bob')


def blackWhiteGame(size, Arr):
	zero = Arr.count(0)
	one = Arr.count(1)
	s = 0
	for i in range(size):
		if i == 0:
			s += Arr[0] == Arr[size - 1]
		else:
			s += Arr[i] == Arr[i - 1]
	s -= abs(zero - one)
	if s % 4 == 0:
		return 'Bob'
	return 'Alice'
T = int(input())
for _ in range(T):
	size = int(input())
	Arr = list(map(int, input().split()))
	print(blackWhiteGame(size, Arr))


def solve(num, l):
	ones = l.count(1)
	zeroes = l.count(0)
	maxi = count_occ(ones, zeroes)
	ref = 0
	for i in range(0, len(l) - 1):
		if l[i] != l[i + 1]:
			ref += 1
	if l[0] != l[len(l) - 1]:
		ref += 1
	if (maxi - ref) // 2 % 2 == 0:
		return 'Bob'
	else:
		return 'Alice'

def count_occ(ones, zeroes):
	if ones == zeroes:
		return 2 * ones
	else:
		return min(ones, zeroes) * 2
n = int(input())
while n:
	num = int(input())
	l = list(map(int, input().split()))
	print(solve(num, l))
	n -= 1


t = int(input())
while t:
	n = int(input())
	l = list(map(int, input().split()))
	(zeros, ones) = (0, 0)
	if l[0] == l[n - 1]:
		if l[0]:
			ones += 1
		else:
			zeros += 1
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			if l[i]:
				ones += 1
			else:
				zeros += 1
	moves = min(zeros, ones)
	print('Alice') if moves & 1 else print('Bob')
	t -= 1


for i in range(int(input())):
	N = int(input())
	arr = [int(x) for x in input().split()]
	count0 = 0
	count1 = 0
	for i in range(len(arr)):
		if arr[i] == 0:
			count0 += 1
		if arr[i] == 1:
			count1 += 1
	count = 0
	for i in range(len(arr) - 1):
		if arr[i] != arr[i + 1]:
			count += 1
	if arr[0] != arr[len(arr) - 1]:
		count += 1
	ans = (2 * min(count0, count1) - count) / 2 % 2
	if ans % 2 == 0:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	one_one = 0
	zero_zero = 0
	for i in range(n):
		if a[i] == 1 and a[(i + 1) % n] == 1:
			one_one += 1
		if a[i] == 0 and a[(i + 1) % n] == 0:
			zero_zero += 1
	valid_moves = min(one_one, zero_zero)
	if valid_moves & 1:
		print('Alice')
	else:
		print('Bob')


for t in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	(o, z) = (0, 0)
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			if l[i] == 1:
				o += 1
			else:
				z += 1
	if l[n - 1] == l[0] == 1:
		o += 1
	elif l[n - 1] == l[0] == 0:
		z += 1
	mn = min(o, z)
	if mn % 2 == 1:
		print('Alice')
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	adj = 0
	zero = one = 0
	if arr[0] == arr[-1]:
		adj += 1
	for i in range(n - 1):
		if arr[i] == arr[i + 1]:
			adj += 1
		if arr[i] == 0:
			zero += 1
		else:
			one += 1
	if arr[-1] == 0:
		zero += 1
	else:
		one += 1
	diff = adj - abs(one - zero)
	if diff % 4:
		print('Alice')
	else:
		print('Bob')


n = int(input())
for i in range(n):
	s = int(input())
	al = list(map(int, input().split()))
	ad = 0
	ad1 = al.count(0)
	ad0 = al.count(1)
	for j in range(s - 1):
		if al[j] == al[j + 1]:
			ad += 1
	if al[s - 1] == al[0]:
		ad += 1
	if (ad - abs(ad1 - ad0)) % 4 == 0:
		print('Bob')
	else:
		print('Alice')


n = int(input())
for i in range(n):
	c = 0
	d = 0
	t = int(input())
	s = list(map(int, input().split()))
	b = s.count(1)
	u = s.count(0)
	v = abs(b - u)
	for i in range(t - 1):
		if s[i] == s[i + 1]:
			c = c + 1
	if s[0] == s[len(s) - 1]:
		d = d + 1
	e = c + d
	if (e - v) % 4 == 0:
		print('Bob')
	else:
		print('Alice')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	count0 = 0
	count1 = 0
	for i in range(n - 1):
		if a[i] == a[i + 1] and a[i] == 0:
			count0 += 1
		elif a[i] == a[i + 1] and a[i] == 1:
			count1 += 1
	if a[0] == a[n - 1] and a[0] == 0:
		count0 += 1
	elif a[0] == a[n - 1] and a[0] == 1:
		count1 += 1
	result = min(count0, count1)
	if result % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def fun(l, n):
	k = 0
	for i in range(n - 1):
		if l[i] == l[i + 1]:
			k += 1
	if l[0] == l[n - 1]:
		k += 1
	k1 = l.count(0)
	k2 = l.count(1)
	k3 = abs(k1 - k2)
	k4 = k - k3
	if k4 % 4 == 0:
		return 'Bob'
	else:
		return 'Alice'
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split(' ')))
	print(fun(l, n))


t = int(input())
for _ in range(t):
	n = int(input())
	A = [int(x) for x in input().split()]
	zeromax = 0
	onemax = 0
	for i in range(n):
		if A[i % n] == 1 and A[(i + 1) % n] == 1:
			onemax += 1
		elif A[i % n] == 0 and A[(i + 1) % n] == 0:
			zeromax += 1
	r = min(zeromax, onemax)
	if r % 2 == 0:
		print('Bob')
	else:
		print('Alice')