import sequtils,strutils var N = stdin.readline.parseInt memo : array[101, int] flag : array[101, bool] flag[1] = true proc grundy(x : int) : int = if flag[x]: return memo[x] var g : array[7, bool] a : int if (x and 1) == 0 and x >= 2: g[0] = true if (x and 1) == 1 and x >= 3: g[grundy(x div 2) xor grundy(x div 2 + 1)] = true if x mod 3 == 0 and x >= 3: g[grundy(x div 3)] = true if x mod 3 == 1 and x >= 4: g[grundy(x div 3 + 1)] = true if x mod 3 == 2 and x >= 5: g[grundy(x div 3)] = true for i in 0..6: if g[i] == false: memo[x] = i flag[x] = true return i if grundy(N) == 0: echo "B" else: echo "A"