s = [] ok = True for i in range(3): s.append(input()) for j, v in enumerate(s[i]): if i != 0 and s[i - 1][j] == v: ok = False # end if j != 0 and s[i][j - 1] == v: ok = False # end # end # end if ok: print("Yes") else: print("No") # end