#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 i) -> int { if (memo[i] != -1) return memo[i]; if (i == 0 || i == 1) return memo[i] = 0; set st; int res = 0; if (i % 3 == 1) { res = self(self, i/3 + 1); } else { res = self(self, i/3); } if (res == 0) return memo[i] = 1; res = 0; if (i & 1) { res = i^(i-1); } else { res = 0; } return memo[i] = res; }; cout << (g(g, n) == 0 ? "B": "A") << "\n"; }