//#define _GLIBCXX_DEBUG #include #define rep(i, n) for(int i=0; i; using vs = vector; using vi = vector; using vvi = vector; template using PQ = priority_queue; template using PQG = priority_queue, greater >; const int INF = 0xccccccc; const ll LINF = 0xcccccccccccccccLL; template inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);} template inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);} template istream &operator>>(istream &is, pair &p) { return is >> p.first >> p.second;} template ostream &operator<<(ostream &os, const pair &p) { return os << p.first << ' ' << p.second;} //head array grundy; array mm; int main() { ios::sync_with_stdio(false); cin.tie(0); grundy[1] = 0; mm[3].emplace_back(0); for(int i = 2; i < 101; i++) { if(~i&1) mm[i].emplace_back(0); sort(all(mm[i])); mm[i].erase(unique(all(mm[i])), mm[i].end()); mm[i].emplace_back(INF); rep(j, mm[i].size()-1) if(mm[i][j] != mm[i][j+1]-1) { grundy[i] = mm[i][j]+1; break; } mm[i*2-1].emplace_back(grundy[i]^grundy[i-1]); mm[i*3].emplace_back(grundy[i]); mm[i*3-1].emplace_back(grundy[i-1]); mm[i*3-2].emplace_back(grundy[i]); } int n; cin >> n; if(grundy[n]) cout << "A\n"; else cout << "B\n"; }