S = input()

ans = "MMA"

if ans == S:
  print("Yes")
else:
  print("No")