s=open(0).read().replace("\n","") print("YNeos"[len(set(s[0::2]))*len(set(s[1::2]))!=1::2])