from itertools import product N = int(input()) S = int(input()) A = [] for a in product(["A","B","C"],repeat=N): if "A" in a and "B" in a and "C" in a: A.append("".join(a)) A = sorted(A) if S>len(A): print(-1) else: print("".join(A[S-1]))