import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random sys.setrecursionlimit(10**9) #sys.set_int_max_str_digits(0) #input = sys.stdin.readline #n = int(input()) #alist = list(map(int,input().split())) #alist = [] #s = input() n = int(input()) s = set() def calc(x,seq): if x == 1: seq.reverse() exit(print(''.join(seq))) return elif x <= 0: return x -= 1 if x % 2 == 0: calc(x//2,seq + ['A']) if x % 3 == 0: calc(x//3,seq + ['B']) calc(n,[])