n = int(input()) a = [] while n > 1: if (n - 1) % 2 == 0: a.append('A') n = (n - 1) // 2 else: a.append('B') n = (n - 1) // 3 print(''.join(a[::-1]))