#include using namespace std; int dfs(vector &g, int N) { if (g[N] != -1) return g[N]; int a = 0; if (N % 2 == 1) { a ^= dfs(g, N/2); a ^= dfs(g, N/2+1); } int b = 0; if (N % 3 != 1) { b ^= dfs(g, N/3); } else { b ^= dfs(g, N/3+1); } for (int i = 0; i < 3; i++) { if (a == i || b == i) continue; g[N] = i; break; } return g[N]; } int main() { int N; cin >> N; vector grundy(N+1, -1); grundy[1] = 0; grundy[2] = 1; dfs(grundy, N); if (grundy[N] == 0) cout << "B" << endl; else cout << "A" << endl; }