g = [input() for _ in range(3)] direction = [(1, 0), (0, 1), (-1, 0), (0, -1)] for i in range(3): for j in range(3): ok = True for dx, dy in direction: ni, nj = i + dx, j + dy if 0 <= ni < 3 and 0 <= nj < 3: if g[i][j] == g[ni][nj]: ok = False if not ok: print("No") exit() print("Yes")