#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; int gmemo[101]; int grundy(int pos){ int &r = gmemo[pos]; if(r!=-1) return r; r = 0; if(pos <= 1)return r; set st; if(pos % 2 == 0){ st.insert(grundy(pos / 2) ^ grundy(pos / 2)); } else{ st.insert(grundy(pos / 2) ^ grundy(pos / 2 + 1)); } if(pos >= 3){ if(pos % 3 == 0){ st.insert(grundy(pos / 3) ^ grundy(pos / 3) ^ grundy(pos / 3)); } else if(pos % 3 == 1){ st.insert(grundy(pos / 3) ^ grundy(pos / 3) ^ grundy(pos / 3 + 1)); } else{ st.insert(grundy(pos / 3) ^ (grundy(pos / 3 + 1) ^ grundy(pos / 3 + 1))); } } while(st.count(r))r++; return r; } int main(){ MEM(gmemo, -1); int N; cin >> N; int ans = grundy(N); puts(ans ? "A" : "B"); }