import std.algorithm, std.array, std.container, std.range, std.bitmanip; import std.numeric, std.math, std.bigint, std.random, core.bitop; import std.string, std.regex, std.conv, std.stdio, std.typecons; void main() { auto n = readln.chomp.to!int; auto memo = new int[](n + 1); memo[1] = 0; if (n >= 2) memo[2] = 1; if (n >= 3) memo[3] = 2; foreach (i; 4..n+1) { int a2 = calc2(i, memo); int a3 = calc3(i, memo); memo[i] = mex(a2, a3); } writeln(memo[n] == 0 ? "B" : "A"); } int calc2(int n, int[] memo) { if (n % 2 == 0) return memo[n / 2] ^ memo[n / 2]; else return memo[n / 2] ^ memo[n / 2 + 1]; } int calc3(int n, int[] memo) { if (n % 3 == 0) return memo[n / 3] ^ memo[n / 3] ^ memo[n / 3]; else if (n % 3 == 1) return memo[n / 3] ^ memo[n / 3] ^ memo[n / 3 + 1]; else return memo[n / 3] ^ memo[n / 3 + 1] ^ memo[n / 3 + 1]; } int mex(int a2, int a3) { auto r = 0; while (r == a2 || r == a3) ++r; return r; }