#include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector memo(n+1, -1); auto g = [&] (auto self, int a) -> int { if (a == 0) return memo[a] = 0; if (a == 1) return memo[a] = 0; if (memo[a] != -1) return memo[a]; int res = 0; if (a & 1) { res ^= self(self, a/2); res ^= self(self, a/2 + 1); } else { res ^= self(self, a/2); } if (a % 3 == 0) { res ^= self(self, a/3); } else { res ^= self(self, a/3); res ^= self(self, a/3 + 1); } return -1; }; cout << (g(g, n) == 0? "B" : "A") << "\n"; }