import sys int1 = lambda x: int(x) - 1 # input = lambda: sys.stdin.buffer.readline() input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) i1 = lambda: int1(input()) mi = lambda: map(int, input().split()) mi1 = lambda: map(int1, input().split()) li = lambda: list(mi()) li1 = lambda: list(mi1()) lli = lambda n: [li() for _ in range(n)] INF = float("inf") mod = int(1e9 + 7) # mod = 998244353 ans = "Yes" s = [input() for i in range(3)] for i in range(3): for j in range(3): if i + 1 < 3 and s[i + 1][j] == s[i][j]: ans = "No" if j + 1 < 3 and s[i][j + 1] == s[i][j]: ans = "No" print(ans)