s = input() s += input() s += input() flag = True if s[0] == "#": p = "." for i in range(len(s)): if i%2 == 0: if s[i] != s[0]: flag = False else: if s[i] != p: flag = False print("Yes" if flag else "No")