Alice and Bob are playing a game.

They start with a positive integer $n$ and take alternating turns doing operations on it. Each turn a player can subtract from $n$ one of its divisors that isn't $1$ or $n$. The player who cannot make a move on his/her turn loses. Alice always moves first.

Note that they subtract a divisor of the current number in each turn.

You are asked to find out who will win the game if both players play optimally.


-----Input-----

The first line contains a single integer $t$ ($1 \leq t \leq 10^4$) — the number of test cases. Then $t$ test cases follow.

Each test case contains a single integer $n$ ($1 \leq n \leq 10^9$) — the initial number.


-----Output-----

For each test case output "Alice" if Alice will win the game or "Bob" if Bob will win, if both players play optimally.


-----Examples-----

Input
4
1
4
12
69
Output
Bob
Alice
Alice
Bob


-----Note-----

In the first test case, the game ends immediately because Alice cannot make a move.

In the second test case, Alice can subtract $2$ making $n = 2$, then Bob cannot make a move so Alice wins.

In the third test case, Alice can subtract $3$ so that $n = 9$. Bob's only move is to subtract $3$ and make $n = 6$. Now, Alice can subtract $3$ again and $n = 3$. Then Bob cannot make a move, so Alice wins.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Number theory

Game theory

Mathematics


Solutions:
import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	if n == 1:
		return 'Bob'
	cnt = 0
	v = n
	while v % 2 == 0:
		v //= 2
		cnt += 1
	if v > 1:
		return 'Alice' if cnt > 0 else 'Bob'
	else:
		return 'Alice' if cnt % 2 == 0 else 'Bob'
for _ in range(int(input())):
	print(solve())


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n % 2 == 1:
		print('Bob')
	elif math.log2(n) == int(math.log2(n)):
		if int(math.log2(n)) % 2 == 1:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Alice')


import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def N():
	return int(inp())

def testcase(t):
	for p in range(t):
		solve()
bad = set()
for i in range(1, 40, 2):
	bad.add(2 ** i)

def solve():
	n = N()
	if n % 2:
		print('Bob')
		return
	if n in bad:
		print('Bob')
		return
	print('Alice')
testcase(N())


import sys
input = sys.stdin.readline

def check(n):
	if n % 2 == 1:
		return False
	cnt = 0
	while n % 2 == 0:
		n //= 2
		cnt += 1
	if cnt % 2 == 1 and n == 1:
		return False
	return True
T = int(input())
for _ in range(T):
	n = int(input())
	if check(n):
		print('Alice')
	else:
		print('Bob')


ans = []
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		ans.append('Bob')
		continue
	cnt = 0
	while n % 2 == 0:
		n //= 2
		cnt += 1
	if n != 1 or cnt % 2 == 0:
		ans.append('Alice')
	else:
		ans.append('Bob')
print('\n'.join(ans))


import sys
import os
if 'CP_LOCAL' in os.environ:
	sys.stdin = open('codeforces/input.txt', 'r')
	sys.stdout = open('codeforces/output.txt', 'w')
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(n):
	if n <= 3:
		return 'Bob'
	if n % 2 == 1:
		return 'Bob'
	elif n & n - 1 == 0:
		c = 0
		while n != 1:
			c += 1
			n //= 2
		return 'Bob' if c % 2 == 1 else 'Alice'
	else:
		return 'Alice'
T = inp()
for _ in range(T):
	n = inp()
	print(solve(n))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n % 2:
		winner = 'Bob'
	else:
		k = 0
		while n % 2 == 0:
			n //= 2
			k += 1
		if n == 1:
			if k % 2:
				winner = 'Bob'
			else:
				winner = 'Alice'
		else:
			winner = 'Alice'
	print(winner)


import sys, math
input = lambda : sys.stdin.readline().rstrip()
I = lambda : [*map(int, input().split())]
for t in range(I()[0]):
	(n,) = I()
	if n & 1:
		print('Bob')
	elif not (n and (not n & n - 1)):
		print('Alice')
	else:
		cnt = 0
		while n % 2 == 0:
			n //= 2
			cnt += 1
		if cnt & 1:
			print('Bob')
		else:
			print('Alice')


import sys
from math import log2
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	if n % 2 == 1:
		print('Bob')
		continue
	x = log2(n)
	if int(x) == x:
		print('Alice' if x % 2 == 0 else 'Bob')
	else:
		print('Alice')


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	elif n % 2 == 0 and bin(n)[2:].count('1') != 1:
		print('Alice')
	else:
		m = int(math.log(n, 2))
		if m % 2 == 0:
			print('Alice')
		else:
			print('Bob')


import bisect
from collections import *
from itertools import *
import math
import heapq
import sys
from pprint import pprint
input = sys.stdin.readline
sys.setrecursionlimit(10000)

def inp():
	return int(input())

def inlist():
	return list(map(int, input().split()))

def instring():
	s = input()
	return list(s[:len(s) - 1])

def invariable():
	return map(int, input().split())

class Solution:

	def is_even(self, x):
		return x % 2 == 0

	def main(self, n):
		if not self.is_even(n):
			return False
		res = 0
		while self.is_even(n):
			n /= 2
			res += 1
		return True if n > 1 else res % 2 == 0
t = inp()
outputs = []
for _ in range(t):
	n = inp()
	output = Solution().main(n)
	outputs.append('Alice' if output else 'Bob')
for o in outputs:
	print(o)


import math
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 0:
		t = math.log2(n)
		if math.floor(t) == math.ceil(t):
			if t % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		else:
			print('Alice')
	else:
		print('Bob')


powers_of_two = [pow(2, degree) for degree in range(31)]
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1 or (n in powers_of_two and powers_of_two.index(n) % 2 == 1):
		print('Bob')
	else:
		print('Alice')


def win():
	print('Alice')

def lose():
	print('Bob')
t = int(input())
for T in range(t):
	n = int(input())
	if n & 1:
		lose()
		continue
	p = format(n, 'b')[::-1]
	if p.count('1') == 1:
		if p.find('1') & 1:
			lose()
			continue
	win()


for _ in range(int(input())):
	n = int(input())
	c = 0
	if n % 2 == 1:
		print('Bob')
	else:
		while n % 2 == 0:
			c += 1
			n //= 2
		if n != 1 or c % 2 == 0:
			print('Alice')
		else:
			print('Bob')


def main():
	for _ in range(int(input())):
		n = int(input())
		if n % 2 == 1:
			print('Bob')
		else:
			f = 0
			while n % 2 == 0:
				n //= 2
				f += 1
			if n != 1 or f % 2 == 0:
				print('Alice')
			else:
				print('Bob')
main()


for i in range(int(input())):
	n = int(input())
	print(['Alice', 'Bob'][n % 2 or (bin(n)[2:].count('1') == 1 and (len(bin(n)) + 1) % 2)])


import math
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		c = 0
		while n % 2 == 0:
			c += 1
			n = n // 2
		if n > 1:
			print('Alice')
		elif c % 2 == 0:
			print('Alice')
		else:
			print('Bob')


def ss(n):
	if n % 2 == 1:
		return 'Bob'
	else:
		a = 0
		while n > 0 and n % 2 == 0:
			a += 1
			n = n // 2
		if n > 1:
			return 'Alice'
		else:
			if a % 2 == 0:
				return 'Alice'
			return 'Bob'
for i in range(int(input())):
	n = int(input())
	print(ss(n))


def second_wins(n: int):
	if n <= 3:
		return True
	if n & 1:
		return True
	p2 = 0
	while n & 1 == 0:
		p2 += 1
		n >>= 1
	if n > 1:
		return False
	else:
		return p2 & 1

def solve():
	n = int(input())
	print('Bob' if second_wins(n) else 'Alice')

def main():
	t = int(input())
	for __ in range(t):
		solve()
main()


from sys import stdin, stdout
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as cmb, permutations as pmb
from math import factorial as f, ceil, gcd, sqrt, log, inf
mi = lambda : map(int, input().split())
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))
mati = lambda r: [li() for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)
MOD = 10 ** 9 + 7

def soe(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def ncr(n, r):
	(p, k) = (1, 1)
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			(p, k) = (p * n, k * r)
			m = gcd(p, k)
			(p, k) = (p // m, k // m)
			(n, r) = (n - 1, r - 1)
	else:
		p = 1
	return p

def solve():
	n = ii()
	c = 0
	if n % 2 == 1:
		print('Bob')
		return
	while n % 2 == 0:
		n //= 2
		c += 1
	if n > 1:
		print('Alice')
	elif c % 2 == 0:
		print('Alice')
	else:
		print('Bob')
for _ in range(ii()):
	solve()


def solve(n):
	if n & 1:
		return 'Bob'
	else:
		cnt = 0
		while n % 2 == 0:
			n = n // 2
			cnt += 1
		if n > 1:
			return 'Alice'
		elif cnt % 2 == 1:
			return 'Bob'
		else:
			return 'Alice'
t = int(input())
for i in range(t):
	n = int(input())
	print(solve(n))


def suresh(n):
	if n & 1 == 1:
		return 'Bob'
	count = 0
	while n & 1 == 0:
		n //= 2
		count += 1
	if n > 1:
		return 'Alice'
	if count & 1 != 0:
		return 'Bob'
	return 'Alice'
for t in range(int(input())):
	n = int(input())
	print(suresh(n))


t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		while n % 4 == 0:
			n //= 4
		if n == 2:
			print('Bob')
		else:
			print('Alice')


import math

def isPowerOfTwo(x):
	return x and (not x & x - 1)
t = int(input())
for hh in range(0, t):
	n = int(input())
	if n == 1 or n == 2 or n == 3:
		print('Bob')
	elif n % 2 == 0:
		if isPowerOfTwo(n):
			cnt = math.log2(n)
			if cnt % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		else:
			print('Alice')
	else:
		print('Bob')


def f(n):
	if n == 2:
		return True
	else:
		return not f(n // 2)
N = int(input())
for _ in range(N):
	n = int(input())
	if n % 2:
		print('Bob')
	else:
		t = n
		while t & 1 == 0:
			t >>= 1
		if t != 1:
			print('Alice')
		else:
			print('Alice' if not f(n) else 'Bob')


for _ in range(int(input())):
	n = int(input())
	k = 0
	f = 1
	if n & 1:
		f = 0
	else:
		while n % 2 == 0:
			n = n / 2
			k = k + 1
		if n == 1 and k % 2 == 1:
			f = 0
	print(['Bob', 'Alice'][f])


from math import log2
for i in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print('Bob')
	elif n & n - 1 != 0:
		print('Alice')
	else:
		a = int(log2(n))
		if a % 2 == 0:
			print('Alice')
		else:
			print('Bob')


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	elif n and (not n & n - 1):
		if int(math.log(n, 2)) % 2 == 0:
			print('Alice')
		else:
			print('Bob')
	else:
		print('Alice')


tests = int(input())
for _ in range(tests):
	i = 1
	test = int(input())
	if test & 1 == 1:
		print('Bob')
	elif test & test - 1 == 0:
		while 1 << i <= test:
			i += 1
		i -= 1
		if i & 1 == 1:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Alice')


d = {}
d[1] = 'Bob'
d[2] = 'Bob'
d[3] = 'Bob'
d[4] = 'Alice'
d[5] = 'Bob'

def check(n):
	c = 0
	while n % 2 == 0:
		c = c + 1
		n = n // 2
	if n != 1:
		return 'Alice'
	elif c % 2 == 0:
		return 'Alice'
	else:
		return 'Bob'

def find(n):
	if n in d:
		return d[n]
	elif n % 2 == 1:
		return 'Bob'
	else:
		return check(n)
t = int(input())
for _ in range(t):
	n = int(input())
	print(find(n))


import math
for _ in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		x = math.log10(n) / math.log10(2)
		if math.ceil(x) == math.floor(x):
			if x % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		else:
			print('Alice')


import math
import collections
from itertools import permutations
from itertools import combinations

def prob():
	n = int(input())
	if n % 2 == 1:
		print('Bob')
		return
	ct = 0
	while n % 2 == 0:
		n = n // 2
		ct += 1
	if n > 1:
		print('Alice')
	elif ct % 2 == 0:
		print('Alice')
	else:
		print('Bob')
t = 1
t = int(input())
for _ in range(0, t):
	prob()


def solve(n):
	if n % 2 == 1:
		return 'Bob'
	exp = 0
	while n % 2 == 0:
		exp += 1
		n //= 2
	if n > 1:
		return 'Alice'
	if exp % 2 == 0:
		return 'Alice'
	return 'Bob'
for _ in range(int(input())):
	n = int(input())
	print(solve(n))


prime = [2, 3, 5]

def solve(n):
	if n % 2:
		return 'Bob'
	c = 0
	while n % 2 == 0:
		c += 1
		n = n // 2
	if n == 1:
		if c % 2:
			return 'Bob'
		return 'Alice'
	else:
		return 'Alice'
for case in range(int(input())):
	n = int(input())
	ans = solve(n)
	print(ans)


from math import log2, floor
t = int(input())
for _ in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	elif log2(n) == floor(log2(n)):
		if floor(log2(n)) % 2 == 1:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Alice')


def solve(n):
	c = 0
	if n % 2:
		return 'Bob'
	while n % 2 == 0:
		n = n // 2
		c += 1
	if n > 1:
		return 'Alice'
	elif c % 2:
		return 'Bob'
	return 'Alice'
for case in range(int(input())):
	n = int(input())
	ans = solve(n)
	print(ans)


import math

def solve(case):
	if case % 2 == 1 or (case & case - 1 == 0 and int(math.log(case, 2)) % 2 == 1):
		return 'Bob'
	return 'Alice'
num_cases = int(input())
cases = []
for k in range(num_cases):
	case = int(input())
	print(solve(case))


tests = int(input())

def Solve(tests):
	for i in range(int(tests)):
		n = int(int(input()))
		if n % 2 == 1:
			print('Bob')
		else:
			f = 0
			while n % 2 == 0:
				n = n / 2
				f += 1
			if n != 1 or f % 2 == 0:
				print('Alice')
			else:
				print('Bob')
Solve(tests)


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
		continue
	count = 0
	while n % 2 == 0:
		count += 1
		n /= 2
	if n > 1:
		print('Alice')
	elif count % 2 == 0:
		print('Alice')
	else:
		print('Bob')


T = int(input())
for i in range(0, T):
	n = int(input())
	p = 2
	while p < n:
		p *= 4
	if p == n or n % 2 == 1:
		print('Bob')
	else:
		print('Alice')


for _ in range(int(input())):
	n = int(input())
	nn = n
	cnt = 0
	while nn % 2 == 0:
		nn = nn // 2
		cnt += 1
	if nn == 1:
		if cnt % 2 == 1 or cnt == 0:
			print('Bob')
		else:
			print('Alice')
	elif n % 2 == 0:
		print('Alice')
	else:
		print('Bob')


t = int(input())
for task in range(t):
	n = int(input())
	even = 0
	while n % 2 == 0:
		even += 1
		n = n // 2
	if even == 0 or (n == 1 and even % 2 == 1):
		print('Bob')
	else:
		print('Alice')


import math

def solve():
	n = int(input())
	if n & 1:
		print('Bob')
	else:
		c = 0
		while n % 2 == 0:
			n //= 2
			c += 1
		if n > 1:
			print('Alice')
		elif c % 2:
			print('Bob')
		else:
			print('Alice')
t = int(input())
for z in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	if n & 1:
		print('Bob')
	else:
		ct = 0
		while n % 2 == 0:
			n //= 2
			ct += 1
		if n > 1:
			print('Alice')
		elif ct % 2:
			print('Bob')
		else:
			print('Alice')


t = int(input())
while t > 0:
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		count = 0
		while n % 2 == 0:
			n /= 2
			count += 1
		if n > 1:
			print('Alice')
		elif count % 2 == 1:
			print('Bob')
		else:
			print('Alice')
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		cnt = 0
		while n % 2 == 0:
			n = n // 2
			cnt += 1
		if n != 1 or cnt % 2 == 0:
			print('Alice')
		else:
			print('Bob')


import math as m
t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
		continue
	cnt = 0
	while n % 2 == 0:
		cnt += 1
		n /= 2
	if n > 1:
		print('Alice')
	elif cnt % 2 == 0:
		print('Alice')
	else:
		print('Bob')


T = int(input())
for tc in range(T):
	n = int(input())
	res = 0
	if n % 2 == 1:
		res = 1
	else:
		nc = n
		pow2 = 0
		while nc % 2 == 0:
			nc = nc // 2
			pow2 += 1
		if nc == 1:
			if pow2 % 2 == 0:
				res = 0
			else:
				res = 1
		else:
			res = 0
	if res == 0:
		print('Alice')
	else:
		print('Bob')


from math import log2
for _ in range(int(input())):
	n = int(input())
	if n & 1:
		print('Bob')
	elif log2(n) % 1 == 0:
		if int(log2(n)) & 1:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Alice')


import math
for i in range(int(input())):
	n = int(input())
	if n % 2:
		print('Bob')
	elif 2 ** int(math.log(n, 2)) == n:
		if int(math.log(n, 2)) % 2:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Alice')


import math
try:
	for _ in range(int(input())):
		n = int(input())
		if n % 2 != 0:
			print('Bob')
		elif 2 ** int(math.log(n, 2)) == n:
			if int(math.log(n, 2)) % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		else:
			print('Alice')
except e:
	pass


import math

def is_power(x, y):
	if x == 1:
		return y == 1
	p = 1
	while p < y:
		p *= x
	return p == y

def f():
	T = int(input())
	for t in range(T):
		n = int(input())
		if n % 2 == 1:
			print('Bob')
		elif is_power(2, n) == False:
			print('Alice')
		elif int(math.log(n) / math.log(2)) % 2 == 1:
			print('Bob')
		else:
			print('Alice')
f()


import math
n = int(input())
while n > 0:
	n = n - 1
	value = int(input())
	if value == 1 or value == 2:
		print('Bob')
		continue
	if value % 2 == 0:
		if math.log2(value) == int(math.log2(value)):
			value = int(math.log2(value))
			if value % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		else:
			print('Alice')
		continue
	else:
		print('Bob')


for _ in range(int(input())):
	n = int(input())

	def fun(n):
		if n % 2 == 1:
			return 2
		c = 0
		while n % 2 == 0:
			c += 1
			n //= 2
		if n > 1:
			return 1
		if c % 2 == 0:
			return 1
		return 2
	if fun(n) == 1:
		print('Alice')
	else:
		print('Bob')


POWER_OF_2 = [2 ** i for i in range(32)]

def solve(N):
	if N & 1 == 1:
		return 'Bob'
	for i in range(32):
		if POWER_OF_2[i] == N:
			if i & 1 == 1:
				return 'Bob'
			else:
				return 'Alice'
	return 'Alice'
T = int(input())
for t in range(T):
	N = int(input())
	print(solve(N))


import math
for _ in range(int(input())):
	n = int(input())
	c = 0
	if n % 2 == 1:
		print('Bob')
	else:
		x = math.log2(n)
		y = math.ceil(x)
		if x == y:
			while n != 2:
				c = c + 1
				n = n / 2
			if c % 2 == 0:
				print('Bob')
			else:
				print('Alice')
		else:
			print('Alice')


def power2(n):
	if n == 1 or n == 2:
		return 1
	elif n == 4:
		return 0
	times = 0
	while n != 1:
		if n % 2 == 0:
			n = n // 2
			times += 1
		else:
			return -1
	return times
for t in range(int(input())):
	n = int(input())
	check = power2(n)
	if check != -1:
		if check == 1:
			print('Bob')
		elif check == 0:
			print('Alice')
		elif check % 2 == 0:
			print('Alice')
		elif check % 2 != 0:
			print('Bob')
	elif n % 2 == 0:
		print('Alice')
	else:
		print('Bob')


import sys

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s
1000000007
mod = int(1000000000.0) + 7

def sinp():
	return sys.stdin.readline().strip()

def zinp():
	return int(input())

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

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

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
for _ in range(zinp()):
	n = zinp()
	if n & 1:
		print('Bob')
	else:
		m = 0
		while n % 2 == 0:
			n = n // 2
			m += 1
		if n > 1:
			print('Alice')
		elif m % 2:
			print('Bob')
		else:
			print('Alice')


t = int(input())
for i in range(t):
	n = int(input())
	if n % 2 == 0:
		n /= 2
		bob = True
		while n > 1:
			if n % 4:
				bob = False
				break
			n //= 4
		if bob:
			print('Bob')
		else:
			print('Alice')
	else:
		print('Bob')


def solve(n):
	if n % 2:
		return 'Bob'
	pw = 0
	while n % 2 == 0:
		pw += 1
		n = n // 2
	if n > 1:
		return 'Alice'
	else:
		if pw % 2:
			return 'Bob'
		return 'Alice'
for caser in range(int(input())):
	n = int(input())
	ans = solve(n)
	print(ans)


import random
for i in range(int(input())):
	n = int(input())
	if n % 2 == 1:
		print('Bob')
	else:
		f = 0
		while n % 2 == 0:
			n = n / 2
			f += 1
		if n != 1 or f % 2 == 0:
			print('Alice')
		else:
			print('Bob')


import math

def sol(A):
	if A % 2 != 0:
		return 'Bob'
	else:
		count = 0
		while A % 2 == 0:
			A = A // 2
			count += 1
		if A > 1:
			return 'Alice'
		elif count % 2 == 0:
			return 'Alice'
		else:
			return 'Bob'
x = int(input())
for _ in range(x):
	y = int(input())
	print(sol(y))


for _ in range(int(input())):
	n = int(input())
	m = n
	p = 0
	while m % 2 == 0:
		m = m // 2
		p += 1
	if m == 1:
		if p == 0 or p % 2 != 0:
			print('Bob')
		else:
			print('Alice')
	elif n % 2 != 0:
		print('Bob')
	else:
		print('Alice')


for testcase in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print('Bob')
		continue
	(k, m) = (0, n)
	while True:
		m = m // 2
		if m == 0:
			break
		k = k + 1
	if n != 2 ** k or k % 2 == 0:
		print('Alice')
	else:
		print('Bob')


arr = [1]
for i in range(33):
	arr.append(arr[-1] * 2)
for _ in range(int(input())):
	n = int(input())
	if n % 2 != 0:
		print('Bob')
	else:
		f = -1
		for i in range(len(arr)):
			if arr[i] == n:
				f = i
		if f == -1:
			print('Alice')
		elif f % 2 == 0:
			print('Alice')
		else:
			print('Bob')