n=int(input()) def f(x): if x == 1: return '' if x % 2 == 1: y = g(x//2) if y is not None: return y + 'A' if x % 3 == 1: y = g(x//3) if y is not None: return y + 'B' return None print(f(n))