n, k = map(int, input().split()) k -= 1 SU = [("", 0)] S = [] while SU: s, f = SU.pop() if f == -1: S.pop() continue S.append(s) if len(S) == n+1 and f: if k: k -= 1 else: exit(print("".join(S))) elif len(S) == n+1: pass else: SU.append(("", -1)) SU.append(("M", f)) SU.append(("", -1)) if len(S) >= 2 and S[-2] + S[-1] == "MM": SU.append(("A", 1)) else: SU.append(("A", f))