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