#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector dp(n + 1, -1); auto func = [&](auto&& self, int x) -> int { if(dp[x] != -1) return dp[x]; if(x == 1) return dp[x] = 0; set G; if(x % 2 == 0){ G.emplace(self(self, x / 2) ^ self(self, x / 2)); } else{ G.emplace(self(self, x / 2) ^ self(self, x / 2 + 1)); } if(x >= 3){ if(x % 3 == 0){ G.emplace(self(self, x / 3) ^ self(self, x / 3) ^ self(self, x / 3)); } else if(x % 3 == 1){ G.emplace(self(self, x / 3) ^ self(self, x / 3) ^ self(self, x / 3 + 1)); } else{ G.emplace(self(self, x / 3) ^ self(self, x / 3 + 1) ^ self(self, x / 3 + 1)); } } int res = 0; for(int i = 0; i <= 5; ++i){ if(!G.count(i)){ res = i; break; } } return dp[x] = res; }; cout << (func(func, n) ? "A\n" : "B\n"); return 0; }