import sys input = lambda :sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) ms = lambda: map(str, input().split()) mf = lambda: map(float, input().split()) li = lambda: list(mi()) def main(): N = ii() def dfs(n, s): if n == 1: print(s[::-1]) quit() if((n - 1) % 2 == 0): dfs((n - 1) / 2, s + "A") if((n - 1) % 3 == 0): dfs((n - 1) / 3, s + "B") dfs(N, "") print() if __name__ == '__main__': main()