N=int(input()) S=[["",N]] i=0 while 1: s,n=S[i][0],S[i][1] if n==1:exit(print(s)) if n%2:S+=[["A"+s,n//2]] if n%3==1:S+=[["B"+s,n//3]] i+=1