n,k=list(map(int,input().split())) s=[] b=bin(k)[2:] b=b.replace("1","MMA",1) b=b.replace("1","M") b=b.replace("0","A") print(b)