""" https://yukicoder.me/problems/no/3135 2**12 """ import sys N = int(input()) S = int(input()) cnt = 0 for bit in range(3**N): A = [] for i in range(N): A.append( bit % 3 ) bit //= 3 if len(set(A)) == 3: cnt += 1 if cnt == S: A.reverse() ans = [ "ABC"[x] for x in A ] print (*ans, sep="") sys.exit() print (-1)