from itertools import product def make(n: int): res = [] for ps in product(range(3), repeat=n): if not all(x in ps for x in [0, 1, 2]): continue res.append(ps[:]) return res N = int(input()) S = int(input()) cands = make(N) if S > len(cands): print(-1) exit() d = {0: 'A', 1: 'B', 2: 'C'} ans = ''.join(d[x] for x in cands[S-1]) print(ans)