import Control.Applicative import Data.List import Data.Bits import Data.Array mex :: [Int] -> Int mex list = mex_sub 0 $ sort list where mex_sub n [] = n mex_sub n (x:xs) | n == x = mex_sub (n+1) xs | otherwise = n grundy :: Int -> Int grundy 0 = 0 grundy 1 = 0 grundy n = mex $ [foldl1 xor [dp !! (i`div`2) | i<-[n,n+1]]] ++ (if n<3 then [] else [foldl1 xor [dp !! (i`div`3) | i<-[n..n+2]]]) dp :: [Int] dp = [grundy i | i <- [0..]] main = do l <- (read::String->Int) <$> getLine putStrLn $ if dp!!l /= 0 then "A" else "B"