S = "".join(input() for _ in range(3)) if all(a != b for a, b in zip(S, S[1:])): print("Yes") else: print("No")