#include using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector VI; typedef vector VVI; #define REP(i, n) for(int(i)=0;(i)<(n);++(i)) #define FOR(i, f, t) for(int(i)=(f);(i)<(t);(++i)) #define RREP(i, n) for(int(i)=(n)-1;(i)>=0;--(i)) const int MOD = int(1e9+7); const int MAXN = 100; int dp[MAXN+1]; int grundy(const int n){ if(n == 1) return 0; if(dp[n] >= 0) return dp[n]; // 状態遷移先 set s; int m1,m2,m3; m1 = n/2, m2 = n-m1; s.insert(grundy(m1)^grundy(m2)); if(n >= 3){ m1 = n/3, m2 = (n-m1)/2, m3 = n-m1-m2; s.insert(grundy(m1)^grundy(m2)^grundy(m3)); } int g = 0; while(s.count(g)) g++; cerr<<"grundy["<"; for(auto it=s.begin(); it!=s.end(); ++it) cerr<<" "<<*it; cerr<> N; cout << (grundy(N)?"A":"B") << endl; }