Alice and Bob invented the following silly game:

The game starts with an integer, $n$, that's used to build a $\boldsymbol{set}$ of $n$ distinct integers in the inclusive range from $1$ to $n$ (i.e., $set=\{1,2,3,\ldots,n-1,n\}$).
Alice always plays first, and the two players move in alternating turns.
During each move, the current player chooses a prime number, $\boldsymbol{p}$, from $\boldsymbol{set}$. The player then removes $\boldsymbol{p}$ and all of its multiples from $\boldsymbol{set}$.
The first player to be unable to make a move loses the game.

Alice and Bob play $\mathrm{~g~}$ games. Given the value of $n$ for each game, print the name of the game's winner on a new line. If Alice wins, print Alice; otherwise, print Bob.

Note: Each player always plays optimally, meaning they will not make a move that causes them to lose the game if some better, winning move exists.

Input Format

The first line contains an integer, $\mathrm{~g~}$, denoting the number of games Alice and Bob play. 

Each line $\boldsymbol{i}$ of the $\mathrm{~g~}$ subsequent lines contains a single integer, $n$, describing a game.

Constraints

$1\leq g\leq1000$  
$1\leq n\leq10^5$

Subtasks

$1\leq n\leq1000$ for $50\%$ of the maximum score

Output Format

For each game, print the name of the winner on a new line. If Alice wins, print Alice; otherwise, print Bob.

Sample Input 0
3
1
2
5

Sample Output 0
Bob
Alice
Alice

Explanation 0

Alice and Bob play the following $g=3$ games:

We are given $n=1$, so $set=\{1\}$. Because Alice has no valid moves (there are no prime numbers in the set), she loses the game. Thus, we print Bob on a new line.
We are given $n=2$, so $set=\{1,2\}$. Alice chooses the prime number $p=2$ and deletes it from the set, which becomes $set=\{1\}$. Because Bob has no valid moves (there are no prime numbers in the set), he loses the game. Thus, we print Alice on a new line.
We are given $n=5$, so $set=\{1,2,3,4,5\}$. Alice chooses the prime number $p=2$ and deletes the numbers $2$ and $4$ from the set, which becomes $set=\{1,3,5\}$. Now there are two primes left, $3$ and $5$. Bob can remove either prime from the set, and then Alice can remove the remaining prime. Because Bob is left without a final move, Alice will always win. Thus, we print Alice on a new line.

Source: hackerrank | Difficulty: MEDIUM
Tags: Game theory


Solutions:
import sys
prime_pre = [0 for i in range(100001)]
sieve = [0 for i in range(100001)]
for i in range(2, 100000):
	if sieve[i] == 0:
		prime_pre[i] = prime_pre[i - 1] + 1
		for j in range(i, 100001, i):
			sieve[j] = i
	else:
		prime_pre[i] = prime_pre[i - 1]
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	print('Bob' if prime_pre[n] % 2 == 0 else 'Alice')


def rwh_primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
primes = set(rwh_primes(100000))
T = int(input())
for t in range(T):
	n = int(input())
	k = sum(map(lambda x: x <= n, primes))
	if k & 1:
		print('Alice')
	else:
		print('Bob')


import sys
import bisect

def primes_gen(n):
	sieve = [True] * n
	sieve[:2] = [False] * 2
	for p in range(n):
		if sieve[p]:
			yield p
			for i in range(p + p, n, p):
				sieve[i] = False

def solve(n, prms):
	i = bisect.bisect_right(prms, n)
	primes = i
	print('n=%d primes=%d' % (n, primes), file=sys.stderr)
	if primes == 0:
		print('Bob')
	elif primes % 2:
		print('Alice')
	else:
		print('Bob')
n = pow(10, 5)
prms = list(primes_gen(n + 1))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	solve(n, prms)


def is_prime(num):
	if num <= 1:
		return False
	elif num <= 3:
		return True
	elif num % 2 == 0 or num % 3 == 0:
		return False
	i = 5
	while i * i <= num:
		if num % i == 0 or num % (i + 2) == 0:
			return False
		i += 6
	return True

def main():
	game_count = int(input())
	PRIMES = {1: []}
	for _ in range(game_count):
		primes = []
		n = int(input())
		max_n = max([key for key in PRIMES.keys() if key <= n])
		if max_n == n:
			primes = PRIMES[n]
		else:
			primes.extend(PRIMES[max_n])
			start = max_n
			set_ = list(range(start + 1, n + 1))
			for num in set_:
				if is_prime(num):
					primes.append(num)
			PRIMES[n] = primes
		if len(primes) == 0:
			print('Bob')
		elif len(primes) % 2 == 0:
			print('Bob')
		else:
			print('Alice')
main()


from math import sqrt
import sys

def prime_list(n):
	prime = [False, False] + [True for _ in range(n)]
	for i in range(2, int(sqrt(n)) + 1):
		if prime[i]:
			for j in range(i, n // i + 1):
				prime[i * j] = False
	return prime
p = prime_list(100001)
cmsm = [0]
for i in range(1, len(p)):
	cmsm.append(cmsm[-1] + p[i])
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	print('Alice' if cmsm[n] & 1 else 'Bob')


import sys
pr = [0] * 120000
for i in range(2, 1000):
	if not pr[i]:
		j = i
		while i * j <= 100000:
			pr[i * j] = 1
			j += 1
sum = [0] * 120000
for i in range(2, 110000):
	sum[i] += sum[i - 1] + (not pr[i])
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if sum[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def getPrimesCount(limit):
	x = [True] * (limit + 1)
	x[0] = x[1] = False
	for i in range(2, int(limit ** 0.5 + 1)):
		if not x[i]:
			continue
		j = i * i
		while j <= limit:
			x[j] = False
			j += i
	primesCount = []
	for i in range(limit + 1):
		if i == 0:
			primesCount.append(0)
			continue
		if x[i]:
			primesCount.append(primesCount[i - 1] + 1)
		else:
			primesCount.append(primesCount[i - 1])
	return primesCount
primesCount = getPrimesCount(1000001)
for g in range(int(input())):
	n = int(input())
	if primesCount[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys

def primes(n):
	if n > 2:
		sieve = [True] * n
		for i in range(3, int(n ** 0.5) + 1, 2):
			if sieve[i]:
				sieve[i * i::2 * i] = [False] * int((n - i * i - 1) / (2 * i) + 1)
		return [2] + [i for i in range(3, n, 2) if sieve[i]]
	else:
		return []
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	m = len(primes(n + 1))
	if m % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
from math import sqrt
primes = []
for i in range(2, 100001):
	if all((i % x != 0 for x in primes[:int(sqrt(i) + 2)])):
		primes.append(i)
primes = set(primes)
primes_under = [0]
counter = 0
for i in range(100002):
	add = 1 if i in primes else 0
	primes_under.append(primes_under[i] + add)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if primes_under[n + 1] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys, math
dp = [0 for x in range(100001)]
primesb = [True for x in range(100001)]
p = 0
for i in range(2, math.ceil(math.sqrt(100001))):
	if primesb[i]:
		j = i * i
		while j < 100001:
			primesb[j] = False
			j += i
for i in range(1, 100001):
	if primesb[i]:
		dp[i] = dp[i - 1] + 1
	else:
		dp[i] = dp[i - 1]
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if dp[n] % 2 == 0:
		print('Alice')
	else:
		print('Bob')


import sys
import math

def check_prime(a):
	for i in range(2, int(math.sqrt(a)) + 1):
		if a % i == 0:
			return False
	return True

def list_prime(n):
	a = []
	for i in range(2, n + 1):
		if check_prime(i):
			a.append(i)
	return a
g = int(input().strip())
prime = list_prime(10 ** 5)
for a0 in range(g):
	n = int(input().strip())
	if n == 1:
		print('Bob')
	elif n == 2:
		print('Alice')
	elif n == 3:
		print('Bob')
	else:
		c = 0
		for i in prime:
			if i <= n:
				c += 1
			else:
				break
		if c % 2 == 0:
			print('Bob')
		else:
			print('Alice')


sieve = [False, False] + [True] * 100000
for p in range(2, 500):
	if sieve[p]:
		for i in range(p * p, 100001, p):
			sieve[i] = False
accum = [0]
for i in range(1, 100001):
	accum.append(accum[i - 1])
	if sieve[i]:
		accum[i] += 1
for _ in range(int(input())):
	n = int(input())
	if accum[n] & 1 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
import math

def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return filter(None, s)
primeNumbers = list(sieve(10000000))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	i = 0
	while primeNumbers[i] <= n:
		i += 1
	if i % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
L = int(100000.0 + 5) * [True]
L[0] = False
L[1] = False
i = 2
while i * i < len(L):
	if L[i] == True:
		j = i * i
		while j < len(L):
			L[j] = False
			j += i
	i += 1
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	cnt = 0
	for j in range(2, n + 1):
		if L[j] == True:
			cnt += 1
	if cnt % 2 == 1:
		print('Alice')
	else:
		print('Bob')


import sys

def get_all_primes(n):
	primes = [2, 3, 5]
	for i in range(6, n):
		for j in primes:
			if j * j > i:
				primes.append(i)
				break
			elif i % j == 0:
				break
	return primes
g = int(input().strip())
primes = get_all_primes(100000)
for a0 in range(g):
	n = int(input().strip())
	n_primes = 0
	for p in primes:
		if p <= n:
			n_primes += 1
		else:
			break
	if n_primes % 2 == 0:
		print('Bob')
	else:
		print('Alice')


from math import sqrt
import sys
primes = [2]

def gen_primes(n):
	for x in range(3, n + 1, 2):
		for i in range(3, int(sqrt(x)) + 1, 2):
			if x % i == 0:
				break
		else:
			primes.append(x)
g = int(input().strip())
all_n = []
for a0 in range(g):
	n = int(input().strip())
	all_n.append(n)
gen_primes(max(all_n))
for x in all_n:
	count = 0
	for y in primes:
		if y <= x:
			count += 1
		else:
			break
	if count % 2 == 0:
		print('Bob')
	else:
		print('Alice')


from base64 import b64decode
from pickle import loads
from math import sqrt
primes = loads(b64decode(b'gANdcQAoSwJLA0sFSwdLC0sNSxFLE0sXSx1LH0slSylLK0svSzVLO0s9S0NLR0tJS09LU0tZS2FLZUtnS2tLbUtxS39Lg0uJS4tLlUuXS51Lo0unS61Ls0u1S79LwUvFS8dL00vfS+NL5UvpS+9L8Uv7TQEBTQcBTQ0BTQ8BTRUBTRkBTRsBTSUBTTMBTTcBTTkBTT0BTUsBTVEBTVsBTV0BTWEBTWcBTW8BTXUBTXsBTX8BTYUBTY0BTZEBTZkBTaMBTaUBTa8BTbEBTbcBTbsBTcEBTckBTc0BTc8BTdMBTd8BTecBTesBTfMBTfcBTf0BTQkCTQsCTR0CTSMCZS4='))

def isprime(x):
	if x == 1 or x == 0:
		return False
	sx = int(sqrt(x))
	for p in primes:
		if p > sx:
			return True
		if x % p == 0:
			return False
	return True
Q = [0 for i in range(100001)]
for i in range(1, 100001):
	Q[i] = Q[i - 1] + 0
	if isprime(i):
		Q[i] += 1
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if Q[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def primes_sieve(limit):
	limitn = limit + 1
	not_prime = [False] * limitn
	primes = []
	for i in range(2, limitn):
		if not_prime[i]:
			continue
		for f in range(i * 2, limitn, i):
			not_prime[f] = True
		primes.append(i)
	return primes
g = int(input().strip())
a = primes_sieve(10 ** 5 + 1)
for a0 in range(g):
	n = int(input().strip())
	primecount = 0
	i = 0
	while i < len(a) and a[i] <= n:
		i += 1
		primecount += 1
	if primecount % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def p(num):
	if num > 1:
		for i in range(2, int(num ** 0.5) + 1):
			if num % i == 0:
				return False
		return True
	return False
l = []
for i in range(10 ** 5):
	if p(i):
		l.append(i)
for i in range(int(input())):
	k = int(input())
	c = 0
	for i in range(len(l)):
		if l[i] > k:
			another = False
			break
		if l[i] == k:
			another = True
			break
	if i != len(l) - 1:
		if another:
			if i % 2 == 0:
				print('Alice')
			else:
				print('Bob')
		elif i % 2 == 1:
			print('Alice')
		else:
			print('Bob')
	else:
		print('Bob')


from sys import exit, stderr

def read(f):
	return map(f, input().split())

def readlist(f):
	return [f(x) for x in input().split()]
maxN1 = 10 ** 5
S = [1] * ((maxN1 + 5) // 3)
S_i = 2
S_n = 2

def sieve(p):
	for x in range(2 * p, maxN1, p):
		m = x % 6
		if m == 5:
			S[(x + 1) // 3] = 0
		elif m == 1:
			S[(x + 2) // 3] = 0
(G,) = read(int)
for g in range(G):
	(N,) = read(int)
	N_m = N % 6
	if N_m == 5:
		N_i = (N + 1) // 3
	elif N_m == 0:
		N_i = N // 3
	else:
		N_i = (N - N_m) // 3 + 1
	while S_i <= N_i:
		if S[S_i]:
			sieve(3 * S_i - 1)
			S_n += 1
		S[S_i] = S_n
		if S[S_i + 1]:
			sieve(3 * S_i + 1)
			S_n += 1
		S[S_i + 1] = S_n
		S_i += 2
	if N <= 1:
		print('Bob')
	elif N == 2:
		print('Alice')
	elif N <= 4:
		print('Bob')
	elif S[N_i] % 2:
		print('Alice')
	else:
		print('Bob')


import sys

def findPrimes(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return filter(None, s)

def main():
	g = int(input().strip())
	for a0 in range(g):
		n = int(input().strip())
		if n == 1:
			print('Bob')
		elif n == 2:
			print('Alice')
		if n != 1 and n != 2:
			primes = list(findPrimes(n))
			if len(primes) % 2 == 0:
				print('Bob')
			else:
				print('Alice')
main()


def prime_sieve(x):
	sieve = list(range(x + 1))
	for i in sieve:
		if i > 1:
			for j in range(i + i, len(sieve), i):
				sieve[j] = 0
	return [1 if i != 0 else 0 for i in sieve]
primes = prime_sieve(10 ** 5)
g = int(input())
for _ in range(g):
	n = int(input())
	print('Bob' if sum(primes[:n + 1]) % 2 else 'Alice')


g = int(input())
n = 10 ** 5
p = [True] * (n + 1)
p[0] = False
p[1] = False
i = 2
while i * i <= n:
	if p[i]:
		j = i * i
		while j <= n:
			p[j] = False
			j += i
	i += 1
c = [0] * (n + 1)
for i in range(2, n + 1):
	c[i] = c[i - 1] + p[i]
for _ in range(g):
	n = int(input())
	print('Alice' if c[n] % 2 == 1 else 'Bob')


def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return list(filter(None, s))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	count = len(sieve(n))
	if count == None:
		print('Bob')
	elif count % 2 == 0:
		print('Bob')
	else:
		print('Alice')


M = 100005
bs = [1] * M

def sieve():
	bs[0] = bs[1] = 0
	for i in range(2, M):
		if bs[i]:
			for j in range(i + i, M, i):
				bs[j] = 0
sieve()
for i in range(M):
	bs[i] += bs[i - 1]
tc = int(input())
while tc:
	tc -= 1
	x = int(input())
	if bs[x] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys

def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return filter(None, s)
prime = []
prime = list(sieve(104729))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	ind = 1
	i = n
	while i >= 2:
		if i in prime:
			ind = prime.index(i)
			break
		i -= 1
	if (ind + 1) % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
mmm = 100000
primes = {}
primes[1] = 1
for i in range(2, int(mmm) + 2):
	if not primes.get(i, False):
		primes[i] = 0
		for j in range(2, mmm // i + 2):
			primes[i * j] = 1
game = {}
game[1] = 0
for i in range(2, int(mmm) + 2):
	game[i] = game[i - 1] + int(primes[i] == 0)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if game[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys

def primes1(n):
	sieve = [True] * (n // 2)
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i // 2]:
			sieve[i * i // 2::i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [2 * i + 1 for i in range(1, n // 2) if sieve[i]]
g = int(input().strip())
nvals = []
for _ in range(g):
	nvals.append(int(input()))
maxval = max(nvals) + 1
primes = set(primes1(maxval))
ans = [False, False]
for i in range(2, maxval):
	ans.append(ans[-1])
	if i in primes:
		ans[-1] = (ans[-1] + 1) % 2
for n in nvals:
	print('Alice' if ans[n] % 2 == 1 else 'Bob')


import sys

def getPrimeList(n):
	size = n // 2
	sieve = [1] * size
	limit = int(n ** 0.5)
	for i in range(1, limit):
		if sieve[i]:
			val = 2 * i + 1
			tmp = (size - 1 - i) // val
			sieve[i + val::val] = [0] * tmp
	return [2] + [i * 2 + 1 for (i, v) in enumerate(sieve) if v and i > 0]
g = int(input())
n_set = [int(input()) for _ in range(g)]
for i in n_set:
	prime_set = getPrimeList(i + 1)
	if i == 1:
		print('Bob')
	elif i == 2:
		print('Alice')
	else:
		l = len(prime_set)
		if l % 2 == 0:
			print('Bob')
		else:
			print('Alice')


import sys

def find_primes():
	arr = [2]
	for i in range(3, 1000000):
		stance = True
		for j in range(2, int(i ** 0.5) + 1):
			if i % j == 0:
				stance = False
				break
		if stance:
			arr.append(i)
	return arr
g = int(input().strip())
arr = find_primes()
for a0 in range(g):
	n = int(input().strip())
	index = 0
	while arr[index] <= n and index < len(arr):
		index += 1
	if index % 2 == 1:
		print('Alice')
	else:
		print('Bob')


import sys

class Game:
	primes = [2, 3]
	lastn = 4

	def get_nprime(self, n):
		count = 0
		for i in range(Game.lastn + 1, n + 1):
			is_prime = True
			for p in Game.primes:
				if i > p and i % p == 0:
					is_prime = False
					break
			if is_prime:
				Game.primes.append(i)
		for p in Game.primes:
			if p > n:
				return count
			count += 1
		if Game.lastn < n:
			Game.lastn = n
		return count
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	game = Game()
	if game.get_nprime(n) % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys

def erat(n):
	sieve = [True] * (n + 1)
	sieve[:2] = [False, False]
	sqrtn = int(n ** 0.5)
	for i in range(2, sqrtn + 1):
		if sieve[i]:
			sieve[2 * i::i] = [False] * (n // i - 1)
	return sieve
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	p = erat(n)
	if p.count(True) % 2 == 1:
		print('Alice')
	else:
		print('Bob')


def primes_sieve(limit):
	limitn = limit + 1
	not_prime = set()
	primes = []
	for i in range(2, limitn):
		if i in not_prime:
			continue
		for f in range(i * 2, limitn, i):
			not_prime.add(f)
		primes.append(i)
	return primes
A = primes_sieve(100000)
B = [90001, 90007, 90011, 90017, 90019, 90023, 90031, 90053, 90059, 90067, 90071, 90073, 90089, 90107, 90121, 90127, 90149, 90163, 90173, 90187, 90191, 90197, 90199, 90203, 90217, 90227, 90239, 90247, 90263, 90271, 90281, 90289, 90313, 90353, 90359, 90371, 90373, 90379, 90397, 90401, 90403, 90407, 90437, 90439, 90469, 90473, 90481, 90499, 90511, 90523, 90527, 90529, 90533, 90547, 90583, 90599, 90617, 90619, 90631, 90641, 90647, 90659, 90677, 90679, 90697, 90703, 90709, 90731, 90749, 90787, 90793, 90803, 90821, 90823, 90833, 90841, 90847, 90863, 90887, 90901, 90907, 90911, 90917, 90931, 90947, 90971, 90977, 90989, 90997, 91009, 91019, 91033, 91079, 91081, 91097, 91099, 91121, 91127, 91129, 91139, 91141, 91151, 91153, 91159, 91163, 91183, 91193, 91199, 91229, 91237, 91243, 91249, 91253, 91283, 91291, 91297, 91303, 91309, 91331, 91367, 91369, 91373, 91381, 91387, 91393, 91397, 91411, 91423, 91433, 91453, 91457, 91459, 91463, 91493, 91499, 91513, 91529, 91541, 91571, 91573, 91577, 91583, 91591, 91621, 91631, 91639, 91673, 91691, 91703, 91711, 91733, 91753, 91757, 91771, 91781, 91801, 91807, 91811, 91813, 91823, 91837, 91841, 91867, 91873, 91909, 91921, 91939, 91943, 91951, 91957, 91961, 91967, 91969, 91997, 92003, 92009, 92033, 92041, 92051, 92077, 92083, 92107, 92111, 92119, 92143, 92153, 92173, 92177, 92179, 92189, 92203, 92219, 92221, 92227, 92233, 92237, 92243, 92251, 92269, 92297, 92311, 92317, 92333, 92347, 92353, 92357, 92363, 92369, 92377, 92381, 92383, 92387, 92399, 92401, 92413, 92419, 92431, 92459, 92461, 92467, 92479, 92489, 92503, 92507, 92551, 92557, 92567, 92569, 92581, 92593, 92623, 92627, 92639, 92641, 92647, 92657, 92669, 92671, 92681, 92683, 92693, 92699, 92707, 92717, 92723, 92737, 92753, 92761, 92767, 92779, 92789, 92791, 92801, 92809, 92821, 92831, 92849, 92857, 92861, 92863, 92867, 92893, 92899, 92921, 92927, 92941, 92951, 92957, 92959, 92987, 92993, 93001, 93047, 93053, 93059, 93077, 93083, 93089, 93097, 93103, 93113, 93131, 93133, 93139, 93151, 93169, 93179, 93187, 93199, 93229, 93239, 93241, 93251, 93253, 93257, 93263, 93281, 93283, 93287, 93307, 93319, 93323, 93329, 93337, 93371, 93377, 93383, 93407, 93419, 93427, 93463, 93479, 93481, 93487, 93491, 93493, 93497, 93503, 93523, 93529, 93553, 93557, 93559, 93563, 93581, 93601, 93607, 93629, 93637, 93683, 93701, 93703, 93719, 93739, 93761, 93763, 93787, 93809, 93811, 93827, 93851, 93871, 93887, 93889, 93893, 93901, 93911, 93913, 93923, 93937, 93941, 93949, 93967, 93971, 93979, 93983, 93997, 94007, 94009, 94033, 94049, 94057, 94063, 94079, 94099, 94109, 94111, 94117, 94121, 94151, 94153, 94169, 94201, 94207, 94219, 94229, 94253, 94261, 94273, 94291, 94307, 94309, 94321, 94327, 94331, 94343, 94349, 94351, 94379, 94397, 94399, 94421, 94427, 94433, 94439, 94441, 94447, 94463, 94477, 94483, 94513, 94529, 94531, 94541, 94543, 94547, 94559, 94561, 94573, 94583, 94597, 94603, 94613, 94621, 94649, 94651, 94687, 94693, 94709, 94723, 94727, 94747, 94771, 94777, 94781, 94789, 94793, 94811, 94819, 94823, 94837, 94841, 94847, 94849, 94873, 94889, 94903, 94907, 94933, 94949, 94951, 94961, 94993, 94999, 95003, 95009, 95021, 95027, 95063, 95071, 95083, 95087, 95089, 95093, 95101, 95107, 95111, 95131, 95143, 95153, 95177, 95189, 95191, 95203, 95213, 95219, 95231, 95233, 95239, 95257, 95261, 95267, 95273, 95279, 95287, 95311, 95317, 95327, 95339, 95369, 95383, 95393, 95401, 95413, 95419, 95429, 95441, 95443, 95461, 95467, 95471, 95479, 95483, 95507, 95527, 95531, 95539, 95549, 95561, 95569, 95581, 95597, 95603, 95617, 95621, 95629, 95633, 95651, 95701, 95707, 95713, 95717, 95723, 95731, 95737, 95747, 95773, 95783, 95789, 95791, 95801, 95803, 95813, 95819, 95857, 95869, 95873, 95881, 95891, 95911, 95917, 95923, 95929, 95947, 95957, 95959, 95971, 95987, 95989, 96001, 96013, 96017, 96043, 96053, 96059, 96079, 96097, 96137, 96149, 96157, 96167, 96179, 96181, 96199, 96211, 96221, 96223, 96233, 96259, 96263, 96269, 96281, 96289, 96293, 96323, 96329, 96331, 96337, 96353, 96377, 96401, 96419, 96431, 96443, 96451, 96457, 96461, 96469, 96479, 96487, 96493, 96497, 96517, 96527, 96553, 96557, 96581, 96587, 96589, 96601, 96643, 96661, 96667, 96671, 96697, 96703, 96731, 96737, 96739, 96749, 96757, 96763, 96769, 96779, 96787, 96797, 96799, 96821, 96823, 96827, 96847, 96851, 96857, 96893, 96907, 96911, 96931, 96953, 96959, 96973, 96979, 96989, 96997, 97001, 97003, 97007, 97021, 97039, 97073, 97081, 97103, 97117, 97127, 97151, 97157, 97159, 97169, 97171, 97177, 97187, 97213, 97231, 97241, 97259, 97283, 97301, 97303, 97327, 97367, 97369, 97373, 97379, 97381, 97387, 97397, 97423, 97429, 97441, 97453, 97459, 97463, 97499, 97501, 97511, 97523, 97547, 97549, 97553, 97561, 97571, 97577, 97579, 97583, 97607, 97609, 97613, 97649, 97651, 97673, 97687, 97711, 97729, 97771, 97777, 97787, 97789, 97813, 97829, 97841, 97843, 97847, 97849, 97859, 97861, 97871, 97879, 97883, 97919, 97927, 97931, 97943, 97961, 97967, 97973, 97987, 98009, 98011, 98017, 98041, 98047, 98057, 98081, 98101, 98123, 98129, 98143, 98179, 98207, 98213, 98221, 98227, 98251, 98257, 98269, 98297, 98299, 98317, 98321, 98323, 98327, 98347, 98369, 98377, 98387, 98389, 98407, 98411, 98419, 98429, 98443, 98453, 98459, 98467, 98473, 98479, 98491, 98507, 98519, 98533, 98543, 98561, 98563, 98573, 98597, 98621, 98627, 98639, 98641, 98663, 98669, 98689, 98711, 98713, 98717, 98729, 98731, 98737, 98773, 98779, 98801, 98807, 98809, 98837, 98849, 98867, 98869, 98873, 98887, 98893, 98897, 98899, 98909, 98911, 98927, 98929, 98939, 98947, 98953, 98963, 98981, 98993, 98999, 99013, 99017, 99023, 99041, 99053, 99079, 99083, 99089, 99103, 99109, 99119, 99131, 99133, 99137, 99139, 99149, 99173, 99181, 99191, 99223, 99233, 99241, 99251, 99257, 99259, 99277, 99289, 99317, 99347, 99349, 99367, 99371, 99377, 99391, 99397, 99401, 99409, 99431, 99439, 99469, 99487, 99497, 99523, 99527, 99529, 99551, 99559, 99563, 99571, 99577, 99581, 99607, 99611, 99623, 99643, 99661, 99667, 99679, 99689, 99707, 99709, 99713, 99719, 99721, 99733, 99761, 99767, 99787, 99793, 99809, 99817, 99823, 99829, 99833, 99839, 99859, 99871, 99877, 99881, 99901, 99907, 99923, 99929, 99961, 99971, 99989, 99991]

def foo(n):
	l = 0
	m = 0
	if n >= 90000:
		l = 8713
		for i in range(len(B)):
			if B[i] > n:
				break
			else:
				l = l + 1
		if l % 2 == 1:
			return 'Alice'
		else:
			return 'Bob'
	else:
		for i in range(n + 1):
			if A[i] > n:
				break
			else:
				m = m + 1
		if m % 2 == 1:
			return 'Alice'
		else:
			return 'Bob'
j = int(input())
Z = []
for i in range(j):
	Z.append(int(input()))
for i in range(j):
	print(foo(Z[i]))


def primes_sieve(limit):
	limitn = limit + 1
	not_prime = set()
	primes = []
	for i in range(2, limitn):
		if i in not_prime:
			continue
		for f in range(i * 2, limitn, i):
			not_prime.add(f)
		primes.append(i)
	return primes
A = primes_sieve(100000)

def foo(n):
	m = 0
	for i in range(len(A)):
		if A[i] > n:
			break
		else:
			m = m + 1
	if m % 2 == 1:
		return 'Alice'
	else:
		return 'Bob'
n = int(input())
for i in range(n):
	print(foo(int(input())))


from array import array
limit = 2 * 3 * 5 * 7 * 11 * 13 * 17
sievebound = (limit - 1) // 2
sieve = array('b', (sievebound + 1) * [0])
crosslimit = (int(limit ** 0.5) - 1) // 2
for i in range(1, crosslimit + 1):
	if not sieve[i]:
		for j in range(2 * i * (i + 1), sievebound + 1, 2 * i + 1):
			sieve[j] = 1
primes = [2]
primes.extend((2 * i + 1 for i in range(1, sievebound + 1) if not sieve[i]))
from bisect import bisect
for _ in range(int(input())):
	print('Alice' if bisect(primes, int(input())) % 2 else 'Bob')


def sieve(n):
	np1 = n + 1
	s = list(range(np1))
	s[1] = 0
	sqrtn = int(round(n ** 0.5))
	for i in range(2, sqrtn + 1):
		if s[i]:
			s[i * i:np1:i] = [0] * len(range(i * i, np1, i))
	return filter(None, s)
for _ in range(int(input())):
	c = int(input())
	a = list(sieve(c))
	if len(a) % 2 == 0:
		print('Bob')
	else:
		print('Alice')


def SOE():
	prime = [1 for i in range(100001)]
	k = [0 for i in range(100001)]
	p = 2
	while p * p <= 100000:
		if prime[p]:
			for i in range(p * 2, 100001, p):
				prime[i] = False
		p += 1
	for i in range(2, 100001):
		k[i] = k[i - 1] + prime[i]
	return k
g = int(input().strip())
prime = SOE()
for a0 in range(g):
	n = int(input().strip())
	if prime[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
m = 100002
A = []
for i in range(m + 1):
	A += [0]
for i in range(2, m + 1):
	if A[i] == 0:
		temp = m // i
		for j in range(2, temp + 1):
			A[i * j] = 1

def countprime(n):
	count = 0
	for i in range(2, n + 1):
		if A[i] == 0:
			count += 1
	return count
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if n == 1:
		print('Bob')
	elif n == 2:
		print('Alice')
	elif n == 3:
		print('Bob')
	elif countprime(n) % 2 == 1:
		print('Alice')
	else:
		print('Bob')


import sys
g = int(input().strip())
A = []
for a0 in range(g):
	n = int(input().strip())
	A = A + [n]
K = max(A)
prime = [0 for i in range(K + 1)]
prime[0] = 1
prime[1] = 1
for i in range(2, K + 1):
	if prime[i] == 0:
		for j in range(2, K // i + 1):
			prime[j * i] = 1
for i in range(len(A)):
	l = A[i]
	count = 0
	for i in range(2, l + 1):
		if prime[i] == 0:
			count += 1
	if count % 2 == 1:
		print('Alice')
	else:
		print('Bob')


import sys

def sieveOfEratosthenes(n):
	if n <= 2:
		return []
	sieve = list(range(3, n, 2))
	top = len(sieve)
	for si in sieve:
		if si:
			bottom = (si * si - 3) // 2
			if bottom >= top:
				break
			sieve[bottom::si] = [0] * -((bottom - top) // si)
	return [2] + [el for el in sieve if el]
primes = sieveOfEratosthenes(10 ** 5)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	answer = 'Alice' if sum((1 for p in primes if p <= n)) % 2 else 'Bob'
	print(answer)


import sys
from bisect import bisect_right

def isprime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	for d in range(2, int(n ** 0.5) + 1):
		if n % d == 0:
			return False
	return True
primes100000 = [i for i in range(2, 100000 + 1) if isprime(i)]

def alicewins(n):
	i = bisect_right(primes100000, n)
	return i % 2 != 0
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	print(alicewins(n) and 'Alice' or 'Bob')


import sys

def rwh_primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def mex(values):
	if values is None or len(values) == 0:
		return 0
	max_val = max(values)
	return min(set(range(max_val + 2)).difference(values))
memo = dict()

def value(state):
	return filter(lambda x: x in primes, state)

def nim_value(state_of_play):
	if state_of_play not in memo:
		moves = []
		n_max = max(state_of_play)
		for item in state_of_play:
			if item in primes:
				moves.append(frozenset(state_of_play).difference(range(item, n_max + 1, item)))
		memo[state_of_play] = mex(list(map(nim_value, moves)))
	return memo[state_of_play]
g = int(input().strip())
ns = []
for a0 in range(g):
	ns.append(int(input()))
primes = set(rwh_primes(max(ns) + 1))
for n in ns:
	print('Alice' if len(list(filter(lambda x: x <= n, primes))) % 2 == 1 else 'Bob')


from sys import stdin

def primes_till(N=100000):
	is_prime = [False for x in range(N + 1)]
	primes_upto = [0 for x in range(N + 1)]
	primes = 0
	for i in range(2, N + 1):
		if is_prime[i] == False:
			primes += 1
			multiplier = 2
			while multiplier * i <= N:
				is_prime[i * multiplier] = True
				multiplier += 1
		primes_upto[i] = primes
	return primes_upto

def alice_wins(arr, N):
	if primes_upto[N] % 2 == 1:
		return True
	else:
		return False
primes_upto = primes_till(100000)
Q = int(stdin.readline())
for _ in range(Q):
	N = int(stdin.readline())
	if alice_wins(primes_upto, N):
		print('Alice')
	else:
		print('Bob')


from bisect import bisect

def makePrimes(n):
	numbers = set()
	primes = []
	for m in range(2, n + 1):
		if m not in numbers:
			primes.append(m)
			num = m
			while num < n:
				numbers.add(num)
				num += m
	return primes
numGames = int(input().strip())
primes = makePrimes(10 ** 6)
for _ in range(numGames):
	n = int(input().strip())
	numPrimes = bisect(primes, n)
	print('Alice' if numPrimes % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


prime = []
for i in range(2, 100001):
	isprime = True
	for itm in prime:
		if i % itm == 0:
			isprime = False
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	j = 0
	jmax = len(prime)
	winner = False
	while j < jmax and prime[j] <= n:
		winner ^= True
		j += 1
	if winner:
		print('Alice')
	else:
		print('Bob')


import sys

def nuprimes(n):
	sieve = [0] + [1] * (n - 1)
	i = 1
	while i < n:
		if sieve[i]:
			sieve[i + (i + 1):n // (i + 1) * (i + 1):i + 1] = [0] * (n // (i + 1) - 1)
		i += 1
	return sieve
g = int(input().strip())
n = [int(input().strip()) for a0 in range(g)]
sv = nuprimes(max(n))
for a0 in range(g):
	print('Alice' if sum(sv[:n[a0]]) % 2 else 'Bob')


prime_nums = [2]
first = 2
g = int(input().strip())
for _ in range(g):
	n = int(input().strip())
	if first < n:
		for i in range(first + 1, n + 1):
			for p in prime_nums:
				if i % p == 0:
					break
			else:
				prime_nums.append(i)
		first = n
	count = 0
	for i in prime_nums:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys
N = 10 ** 5
pi_n = {1: 0}
prime_count = 0
visited = set()
for n in range(2, N + 1):
	if n not in visited:
		prime_count += 1
		idx = 1
		while True:
			if idx * n > N:
				break
			visited.add(idx * n)
			idx += 1
	pi_n[n] = prime_count
g = int(input().strip())
for _ in range(g):
	n = int(input().strip())
	if pi_n[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
ceil = [0] * (10 ** 5 + 1)
primes = []
for i in range(2, 10 ** 5):
	if ceil[i] == 0:
		primes.append(i)
		j = i
		while j <= 10 ** 5:
			ceil[j] = 1
			j += i
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	count = 0
	i = 0
	while i < len(primes) and primes[i] <= n:
		i += 1
		count += 1
	print('Alice' if count % 2 else 'Bob')


import bisect
prime = []
for i in range(2, 100001):
	isprime = True
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


primes = [2]
maxm = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if maxm < n:
		for i in range(maxm + 1, n + 1):
			for p in primes:
				if i % p == 0:
					break
			else:
				primes.append(i)
		maxm = n
	chance = 0
	for i in primes:
		if i > n:
			break
		chance += 1
	print('Alice' if chance % 2 == 1 else 'Bob')


import sys
PRIMES = []
PRIMES_COUNT = []

def is_prime(n):
	if n <= 1:
		return False
	if n == 2:
		return True
	if n % 2 == 0:
		return False
	if n in PRIMES:
		return True
	for i in range(3, int(pow(n, 0.5)) + 1, 2):
		if n % i == 0:
			return False
		i += 2
	PRIMES.append(n)
	return True

def init(max_n):
	count = 0
	for i in range(max_n + 1):
		if is_prime(i):
			count += 1
		PRIMES_COUNT.append(count)
init(10 ** 5)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	primes_count = PRIMES_COUNT[n]
	print('Alice' if primes_count % 2 == 1 else 'Bob')


primes = [None] * 100002
for i in range(2, 100002):
	if primes[i] == None:
		primes[i] = True
		primes[i + i::i] = ([False] * 100002)[i + i::i]
prime_accum = [0] * 100002
count = 0
for i in range(100002):
	if primes[i]:
		count += 1
	prime_accum[i] = count
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	first = prime_accum[n] % 2 == 1
	print('Alice' if first else 'Bob')


import bisect
prime = []
for i in range(2, 100001):
	isprime = True
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


import bisect
prime = []
for i in range(2, 100001):
	isPrime = True
	maxVal = int(i ** 0.5)
	isPrime = True
	for num in prime:
		if num <= maxVal:
			if i % num == 0:
				isPrime = False
				break
		else:
			break
	if isPrime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


import sys

def primes(n):
	n += 1
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * int((n - i * i - 1) / (2 * i) + 1)
	return ([2] if n > 2 else []) + [i for i in range(3, n, 2) if sieve[i]]
g = int(input().strip())
maximum = 0
players = ('Bob', 'Alice')
for a0 in range(g):
	n = int(input().strip())
	if n > maximum:
		prime_list = primes(n)
		maximum = n
		prime_numbers = len(prime_list)
	else:
		for (i, num) in enumerate(prime_list):
			if num > n:
				prime_numbers = i
				break
			prime_numbers = i + 1
	print(players[prime_numbers % 2])


import sys

def isP(n):
	if n <= 3:
		return True
	if (n % 2 == 0) | (n % 3 == 0):
		return False
	for d in range(5, int(n ** 0.5) + 1, 6):
		if (n % d == 0) | (n % (d + 2) == 0):
			return False
	return True

def getP(m):
	P = [1, 2]
	for n in range(3, m + 1, 2):
		if isP(n):
			P.append(n)
	return P
P = getP(int(10 ** 5 + 1000))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	for i in range(len(P)):
		if P[i] > n:
			c = i - 1
			break
	if c % 2 == 1:
		print('Alice')
	else:
		print('Bob')


(p, t, d, l) = ([], 0, [], 1)
for j in range(2, 10 ** 5 + 1):
	c = 1
	for k in range(t):
		if j % p[k] == 0:
			c = 0
			break
	if c == 1:
		p += [j]
		t += 1
		if j >= l * 1000:
			d += [[j, t]]
			l += 1
for i in range(int(input())):
	n = int(input())
	k = n // 1000 - 1
	while k < l - 1 and n >= d[k][0]:
		k += 1
	if k > 0:
		k = d[k - 1][1]
	else:
		k = 0
	while k < t and n >= p[k]:
		k += 1
	if k % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys
import math

def sieve(n):
	if n <= 1:
		return []
	A = [True for i in range(n + 1)]
	upperLimit = math.ceil(math.sqrt(n)) + 1
	for i in range(2, upperLimit):
		if A[i] == True:
			multiplier = 0
			while True:
				if i * i + multiplier * i > n:
					break
				A[i * i + multiplier * i] = False
				multiplier += 1
	primes = []
	for i in range(n + 1):
		if A[i] == True:
			primes.append(i)
	return primes
g = int(input().strip())
N = []
for a0 in range(g):
	n = int(input().strip())
	N.append(n)
maxN = max(N)
primes = sieve(maxN)
lenPrimes = len(primes)
numPrimesUpToN = []
index = 0
total = 0
for i in range(0, maxN + 1):
	if i == primes[index]:
		if index != lenPrimes - 1:
			index += 1
		total += 1
	numPrimesUpToN.append(total)
for a0 in range(g):
	if numPrimesUpToN[N[a0]] % 2 != 0:
		print('Alice')
	else:
		print('Bob')


import sys
prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


N = 100000

def rwh_primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
primes = rwh_primes(N)
g = int(input().strip())
for gg in range(g):
	n = int(input().strip())
	m = sum(map(lambda x: x <= n, primes))
	if m & 1:
		print('Alice')
	else:
		print('Bob')


import bisect
prime = []
for i in range(2, 100001):
	isprime = True
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


import sys
primes = [2]
max_p = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max_p < n:
		for i in range(max_p + 1, n + 1):
			flag = True
			for p in primes:
				if i % p == 0:
					flag = False
					break
			if flag:
				primes.append(i)
		max_p = n
	count = len(list((p for p in primes if p <= n)))
	print('Alice' if count % 2 == 1 else 'Bob')


import sys
import math
prime_table = [2, 3, 5, 7]
inputs = {}

def is_prime(k):
	med = int(math.sqrt(k)) + 1
	for j in range(2, med):
		if k % j == 0:
			return False
	return True
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	counter = 0
	if n == 1:
		print('Bob')
	elif n not in inputs:
		last_prime = prime_table[-1]
		if n > last_prime:
			for i in range(last_prime + 1, n + 1):
				if is_prime(i):
					prime_table.append(i)
		for p in prime_table:
			if p <= n:
				counter += 1
			else:
				break
		if counter % 2 == 0:
			if n not in inputs:
				inputs[n] = 'Bob'
			print('Bob')
		else:
			if n not in inputs:
				inputs[n] = 'Alice'
			print('Alice')
	else:
		print(inputs[n])


import sys

def prime_sieve(n):
	sieve = [True] * (n + 1)
	sieve[0] = False
	sieve[1] = False
	for i in range(2, n + 1):
		if sieve[i]:
			for j in range(2 * i, n + 1, i):
				sieve[j] = False
	return sieve
g = int(input().strip())
ns = [0] * g
for a0 in range(g):
	ns[a0] = int(input().strip())
sieve = prime_sieve(max(ns))
for n in ns:
	prime_count = sum(sieve[:n + 1])
	if prime_count & 1:
		print('Alice')
	else:
		print('Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


primes = [0] * 2 + [1] * 99999
for i in range(2, 100001):
	if primes[i]:
		for j in range(i * i, 100001, i):
			primes[j] = 0
	primes[i] ^= primes[i - 1]
print('\n'.join(('Alice' if primes[int(input())] else 'Bob' for _ in range(int(input())))))


import bisect
prime = []
for i in range(2, 100001):
	isprime = True
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


N = 10 ** 5 + 1
C = [0] * N
P = [1] * N
c = 0
for p in range(2, N):
	C[p] = c
	if not P[p]:
		continue
	C[p] = c = c + 1
	for i in range(p * p, N, p):
		P[i] = 0
for q in range(int(input())):
	print('Alice' if C[int(input())] & 1 else 'Bob')


import sys
g = int(input())

def prime_sieve(n):
	l = [1] * n
	l[0:2] = [0, 0]
	for k in range(2, int(n ** 0.5) + 1):
		if l[k]:
			for i in range(k ** 2, n, k):
				l[i] = 0
	return l
PRIMES = prime_sieve(10 ** 5 + 1)
for _ in range(g):
	n = int(input())
	l = sum(PRIMES[:n + 1])
	if l % 2:
		print('Alice')
	else:
		print('Bob')


import sys
prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
ans = [False] * 100001
(prev, cur) = (2, False)
for p in primes(100001):
	ans[prev:p] = [cur] * (p - prev)
	prev = p
	cur = not cur
ans[prev:100001] = [cur] * (100001 - prev)
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if ans[n]:
		print('Alice')
	else:
		print('Bob')


import sys, functools
from operator import sub
ps = sorted(list(functools.reduce(sub, (set(range(x ** 2, 100000, x)) for x in range(2, int(100000 ** 0.5) + 1)), set(range(2, 100000)))))
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	try:
		idx = next((idx for (idx, v) in enumerate(ps) if v > n))
		print('Alice') if idx % 2 else print('Bob')
	except:
		print('Bob')


N = 100005
f = [True] * N
f[0] = f[1] = False
p = []
for i in range(2, N):
	if not f[i]:
		continue
	p.append(i)
	for j in range(i + i, N, i):
		f[j] = False
for _ in range(int(input().strip())):
	n = int(input().strip())
	a = 0
	c = len(p) - 1
	while a < c:
		b = (a + c) // 2
		if p[b] <= n:
			a = b + 1
		else:
			c = b
	if a % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys

def findPrimes6(n):
	divs = [x for x in range(3, int(n ** 0.5) + 1, 2) if not [n for n in range(3, int(x ** 0.5) + 1, 2) if x % n == 0]]
	nums = [True] * (n // 2 + 1)
	for i in divs:
		nums[int(i ** 2 / 2)::i] = [False] * len(nums[int(i ** 2 / 2)::i])
	return [2] + [x * 2 + 1 for x in range(1, int(n / 2)) if nums[x]]
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if len(findPrimes6(n + 1)) % 2 == 0 or n == 1:
		print('Bob')
	else:
		print('Alice')


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


import sys

def rwh_primes(n):
	if n <= 2:
		return []
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if len(rwh_primes(n + 1)) % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


p = list(range(3, 99992, 2))
p.insert(0, 2)
for i in range(3, 10000, 2):
	p = [x for x in p if x % i != 0 or x == i]
g = int(input().strip())
for a in range(g):
	n = int(input().strip())
	print('Alice' if len([x for x in p if x <= n]) % 2 else 'Bob')


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


from sys import stdin

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

def naive_primes(n):
	c = 0
	for pt in range(2, n + 1):
		if is_prime(pt):
			c += 1
	return c

def prime_sieve(m):
	ps = [mi % 2 == 1 for mi in range(m + 1)]
	for pt in range(3, m):
		if pt * pt > m:
			break
		if not ps[pt]:
			continue
		pti = 3 * pt
		while pti <= m:
			ps[pti] = False
			pti += 2 * pt
	ps[2] = True
	ps[0] = False
	ps[1] = False
	return ps

def running_count(ps):
	out = []
	pc = 0
	for ptb in ps:
		if ptb:
			pc += 1
		out.append(pc)
	return out

def is_prime(n):
	for x in range(2, n):
		if x * x > n:
			return True
		if n % x == 0:
			return False
	return True
(g,) = readInts()
pcs = running_count(prime_sieve(10 ** 5))
for a0 in range(g):
	(n,) = readInts()
	if pcs[n] % 2 == 0:
		print('Bob')
	else:
		print('Alice')


import sys
prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys

def numPrimesBelow(n, primes):
	l = -1
	r = len(primes) - 1
	while r - l > 1:
		m = l + (r - l) // 2
		if primes[m] <= n and primes[m + 1] >= n:
			if primes[m + 1] == n:
				return m + 2
			else:
				return m + 1
		elif primes[m] > n:
			r = m
		else:
			l = m
	if primes[r] <= n:
		return r + 1
	else:
		return r

def gameWinner(games):
	maxGame = max(games)
	primes = primeSieve(maxGame + 1)
	for game in games:
		numPrimes = numPrimesBelow(game, primes)
		if numPrimes % 2 == 0:
			print('Bob')
		else:
			print('Alice')

def primeSieve(n):
	isPrime = [True for i in range(n + 1)]
	isPrime[0] = False
	isPrime[1] = False
	i = 2
	while i ** 2 <= n:
		if isPrime[i]:
			for j in range(i ** 2, n + 1, i):
				isPrime[j] = False
		i += 1
	primes = [i for i in range(2, n) if isPrime[i]]
	return primes
g = int(input().strip())
games = []
for a0 in range(g):
	n = int(input().strip())
	games.append(n)
gameWinner(games)


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


from math import sqrt
import sys

def prime_list(n):
	prime = [False, False] + [True for _ in range(n)]
	for i in range(2, int(sqrt(n)) + 1):
		if prime[i]:
			for j in range(i, n // i + 1):
				prime[i * j] = False
	return prime
p = prime_list(100001)
cmsm = [0]
for i in range(1, len(p)):
	cmsm.append(cmsm[-1] + p[i])
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	print('Alice' if cmsm[n] & 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import bisect
prime = []
for i in range(2, 100001):
	maxval = int(i ** 0.5)
	isprime = True
	for itm in prime:
		if itm <= maxval:
			if i % itm == 0:
				isprime = False
				break
		else:
			break
	if isprime:
		prime.append(i)
g = int(input().strip())
for i in range(g):
	n = int(input().strip())
	moves = bisect.bisect(prime, n)
	moves += moves < len(prime) and prime[moves] == n
	print(('Bob', 'Alice')[moves % 2])


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys
primes = [False if i % 2 == 0 else True for i in range(10 ** 5 + 1)]
(primes[1], primes[2]) = (False, True)
for i in range(3, 10 ** 5):
	if primes[i]:
		for j in range(2 * i, 10 ** 5, i):
			primes[j] = False
(n_primes, primes_smaller) = (0, {})
for i in range(10 ** 5 + 1):
	if primes[i]:
		n_primes += 1
	primes_smaller[i] = n_primes
g = int(input().strip())
for _ in range(g):
	n = int(input().strip())
	print('Alice' if primes_smaller[n] % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	count = 0
	for i in prime:
		if i > n:
			break
		count += 1
	print('Alice' if count % 2 == 1 else 'Bob')


import sys

def isprime(n):
	if n == 2 or n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True
game_count = int(input().strip())
prime_count_map = {}
current_count = 0
for value in range(2, 100000 + 1):
	if isprime(value):
		current_count += 1
	prime_count_map[value] = current_count
for _ in range(game_count):
	n = int(input().strip())
	if n == 1:
		print('Bob')
		continue
	print('Alice' if prime_count_map[n] % 2 == 1 else 'Bob')


prime = [2]
max = 2
g = int(input().strip())
for a0 in range(g):
	n = int(input().strip())
	if max < n:
		for i in range(max + 1, n + 1):
			for p in prime:
				if i % p == 0:
					break
			else:
				prime.append(i)
		max = n
	c = 0
	for i in prime:
		if i > n:
			break
		c += 1
	print('Alice' if c % 2 == 1 else 'Bob')