a = list(input()) b = ["M", "M", "A"] c = 0 for i in range(3): if a[i] == b[i]: c += 1 if c == 3: print("Yes") else: print("No")