#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl #define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i) template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template ostream& operator << (ostream &s, pair P) { return s << '<' << P.first << ", " << P.second << '>'; } template ostream& operator << (ostream &s, vector P) { for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; } template ostream& operator << (ostream &s, vector > P) { for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; } template ostream& operator << (ostream &s, map P) { EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; } int N; int G[110]; int main() { G[1] = 0; for (int n = 2; n <= 100; ++n) { int a1 = n / 2, a2 = n - n / 2; int b1 = n / 3, b3 = (n + 2) / 3, b2 = n - b1 - b3; set se; se.insert(G[a1] ^ G[a2]); if (n >= 3) se.insert(G[b1] ^ G[b2] ^ G[b3]); int res = 0; while (se.count(res)) ++res; G[n] = res; } while (cin >> N) { cout << (G[N] ? 'A' : 'B') << endl; } }