ll n; void f(ll v,string z){ if(v==1){ wt(z); exit(0); } if(v%2==1){ f(v/2,"A"+z); } if(v%3==1){ f(v/3,"B"+z); } } { rd(n); f(n,""); }