#include using namespace std; using ll=long long; map MP; string D(ll N){ if(N==1)return ""; else if(MP.count(N))return MP[N]; string res="?"; if(N%2==1){ string T=D(N/2); if(T!="?"){ MP[N]=T+"A"; return MP[N]; } } if(N%3==1){ string T=D(N/3); if(T!="?"){ MP[N]=T+"B"; return MP[N]; } } MP[N]=res; return res; } int main() { ll N; cin>>N; cout<