s=input() if s[0]==s[1] and list(sorted(list(set(list(s)))))==list(sorted(["M","A"])): print("Yes") else: print("No")