#include using namespace std; typedef pair P; typedef pair> PP; typedef long long ll; const double EPS = 1e-8; const int INF = 1e9; const int MOD = 1e9+7; int dy[] = {0,1,0,-1}; int dx[] = {1,0,-1,0}; int memo[101]; int grundy(int x){ if(memo[x] != -1)return memo[x]; set s; if(x == 0)return memo[x] = 0; else if(x == 1)return memo[x] = 0; else if(x != 0){ if(x%2 == 0)s.insert(grundy(x/2)^grundy(x/2)); if(x%2 == 1)s.insert(grundy(x/2)^grundy(x/2+1)); if(x%3 == 0)s.insert(grundy(x/3)^grundy(x/3)^grundy(x/3)); if(x%3 == 1)s.insert(grundy(x/3)^grundy(x/3)^grundy(x/3+1)); if(x%3 == 2)s.insert(grundy(x/3)^grundy(x/3+1)^grundy(x/3+1)); } int res = 0; while(s.count(res))res++; return memo[x] = res; } int main(void) { fill(memo,memo+101,-1); int x; cin >> x; if(grundy(x) != 0)cout << "A" << endl; else cout << "B" << endl; return 0; }