import sys sys.setrecursionlimit(10**6) import pypyjit pypyjit.set_param('max_unroll_recursion=-1') 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,[])