import Control.Monad import Data.Map.Strict (Map) import qualified Data.Map.Strict as Map import Data.List (sort) main = do g <- readLn ns <- forM [1..g] $ const readLn let solutions = solve $ sort ns forM_ ns $ \n -> putStrLn $ if (even $ solutions Map.! n) then "Bob" else "Alice" solve :: [Int] -> Map Int Int solve ns = fn [2..] ns 0 where fn _ [] _ = Map.singleton 1 0 fn (x:xs) (n:ns) p | x > n = Map.insert n p $ fn (x:xs) (dropWhile (== n) ns) p | otherwise = fn (filter ((/= 0).(`mod` x)) xs) (n:ns) newP where newP = p + if isPrime x then 1 else 0 primes :: Int -> Int primes 1 = 0 primes n = fn [2..n] where fn [] = 0 fn (n:ns) = fn (filter ((/= 0).(`mod` n)) ns) + if isPrime n then 1 else 0 isPrime 1 = False isPrime x = all ((/= 0).(x `mod`)) [2..root] where root = floor $ sqrt $ 0.5 + fromIntegral x