#include using namespace std; template class Grundy { private: map grundy; template int solve(S s) { int g = 0; for (auto t : s) g ^= solve(t); return g; } public: int solve(T t) { if (grundy.count(t)) return grundy[t]; set s; for (auto g : t.next()) s.insert(solve(g)); for (int i = 0; ; ++i) { if (s.count(i) == 0) return grundy[t] = i; } } }; class State { private: int n; public: State (int n) : n(n) {} vector> next() { vector> v; if (n >= 2) v.emplace_back(vector({State(n / 2), State((n + 1) / 2)})); if (n >= 3) v.emplace_back(vector({State(n / 3), State((n + 1) / 3), State((n + 2) / 3)})); return v; } bool operator<(const State& state) const { return n < state.n; } }; int main() { int n; cin >> n; Grundy grundy; cout << (grundy.solve(State(n)) ? "A" : "B") << endl; }