#include #include using namespace std; int gr[110]; void init_grundy(){ gr[1] = 0; for(int i = 2; i <= 110; i++) gr[i] = -1; } int grundy(int x){ if(gr[x] >= 0) return gr[x]; set s; if(x % 2 == 0) s.insert(grundy(x / 2) ^ grundy(x / 2)); else s.insert(grundy(x / 2) ^ grundy(x / 2 + 1)); if(x >= 3){ if(x % 3 == 0) s.insert(grundy(x / 3) ^ grundy(x / 3) ^ grundy(x / 3)); else if(x % 3 == 1) s.insert(grundy(x / 3) ^ grundy(x / 3) ^ grundy(x / 3 + 1)); else s.insert(grundy(x / 3) ^ grundy(x / 3 + 1) ^ grundy(x / 3 + 1)); } int res = 0; while(s.find(res) != s.end()) res++; return gr[x] = res; } int main(){ int n, ans = 0; cin >> n; init_grundy(); if(grundy(n)){ cout << "A" << endl; }else{ cout << "B" << endl; } return 0; }