#include #include using namespace std; int memo[101], n; int grundy(int x) { if (memo[x] != 0 || x == 1 || x == 2)return memo[x]; sets; if (x % 2 == 0) { s.insert(grundy(x / 2) ^ grundy(x / 2)); } else { s.insert(grundy(x / 2) ^ grundy(x / 2 + 1)); } if (x % 3 == 0) { s.insert(grundy(x / 3) ^ grundy(x / 3) ^ grundy(x / 3)); } else if (x % 3 == 1) { s.insert(grundy(x / 3) ^ grundy(x / 3) ^ grundy(x / 3 + 1)); } else { s.insert(grundy(x / 3) ^ grundy(x / 3 + 1) ^ grundy(x / 3 + 1)); } int g = 0; while (s.count(g) != 0)g++; return memo[x] = g; } int main() { cin >> n; memo[1] = 0; memo[2] = 1; if (grundy(n)) { cout << "A" << endl; } else { cout << "B" << endl; } }