using System; using System.Collections.Generic; using System.Linq; public class Program { static int[] memo = { }; static int g(int count) { if(memo[count] != -1) return memo[count]; Dictionary dic = new Dictionary(); if (count >= 2 && count % 2 == 0) dic.Add(g(count / 2) ^ g(count / 2), 1); if (count >= 2 && count % 2 == 1) dic.Add(g(count / 2) ^ g(count / 2 + 1), 1); if (count >= 3 && count % 3 == 0) dic.Add(g(count / 3) ^ g(count / 3) ^ g(count / 3), 1); if (count >= 3 && count % 3 == 1) dic.Add(g(count / 3) ^ g(count / 3) ^ g(count / 3 + 1), 1); if (count >= 3 && count % 3 == 2) dic.Add(g(count / 3) ^ g(count / 3 + 1) ^ g(count / 3 + 1), 1); int ret = 0; while (true) { if(!dic.ContainsKey(ret)) break; ret++; } memo[count] = ret; return ret; } static void Main() { int N = int.Parse(Console.ReadLine()); memo = new int[N + 1]; for (int i = 0; i <= N; i++) memo[i] = -1; if (g(N) != 0) Console.WriteLine("A"); else Console.WriteLine("B"); } }