#include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector grundy(n + 1); grundy[0] = 0; grundy[1] = 0; for (int i = 2; i <= n; i++) { set s; if (i % 2 == 0) s.insert(0); else s.insert(grundy[i / 2] ^ grundy[i / 2 + 1]); if (i % 3 == 0) s.insert(grundy[i / 3]); else if (i % 3 == 1) s.insert(grundy[i / 3 + 1]); else s.insert(grundy[i / 3]); int g = 0; while (s.count(g) != 0) g++; grundy[i] = g; } cout << (grundy[n] != 0 ? "A" : "B") << endl; return 0; }