module main; // https://kmjp.hatenablog.jp/entry/2015/02/16/0900 より // Grundy数 import std; void main() { // 入力 auto N = readln.chomp.to!int; // 答えの計算 auto grundy = new int[](101); grundy[1] = 0; foreach (i; 2 .. 101) { auto rbt = redBlackTree!int(); rbt.insert(grundy[i / 2] ^ grundy[(i + 1) / 2]); if (i >= 3) rbt.insert(grundy[i / 3] ^ grundy[(i + 1) / 3]^ grundy[(i + 2) / 3]); while (grundy[i] in rbt) grundy[i]++; } // 答えの出力 writeln(grundy[N] ? "A" : "B"); }