using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int g = Convert.ToInt32(Console.ReadLine()); for(int a0 = 0; a0 < g; a0++){ int n = Convert.ToInt32(Console.ReadLine()); GetPrimes(n); if (n == 1) { Console.WriteLine("Bob"); continue; } var countPrimes = _primes.Count(p => p <= n); if (countPrimes % 2 == 0) { Console.WriteLine("Bob"); } else { Console.WriteLine("Alice"); } } } static IList _primes = new List { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 }; static void GetPrimes(int n) { var lastIdx = _primes.Count - 1; var highestPrime = _primes[lastIdx]; if (highestPrime >= n) { return; } //count by 2s starting with next odd number since we can skip all even numbers above 2 for(int i=highestPrime + 2; i <= n; i+=2) { var square = Math.Sqrt(i); var idx = 1; //first to test against is 3 bool isPrime = true; while(isPrime && _primes[idx] < square) { isPrime = i % _primes[idx++] != 0; } if (isPrime) { _primes.Add(i); } } } }