import sys sys.setrecursionlimit(10**6) N = int(input()) def dfs(x,y): if x >= N: if x == N: print("".join(y)) exit() return y.append("A") dfs(x*2+1,y) y.pop() y.append("B") dfs(x*3+1,y) y.pop() dfs(1,[])