# from functools import reduce # def gcd(*numbers): # return reduce(math.gcd, numbers) # readline = sys.stdin.readline # write = sys.stdout.write # flush = sys.stdout.flush # sys.setrecursionlimit(500000) # def input(): # return sys.stdin.readline()[:-1] mod = 998244353 def sum_range(n): return n * (n + 1) // 2 def yes(r=True): if r: print('Yes') def yes_exit(r=True): if r: print('Yes') exit() def no(r=True): if r: print('No') def no_exit(r=True): if r: print('No') exit() def yes_no(r): print('Yes' if r else 'No') def yes_no_exit(r): print('Yes' if r else 'No') exit() # S = input() # N = int(input()) # H = int(input()) # K = int(input()) # Q = int(input()) # T = int(input()) # W = int(input()) # X = int(input()) # N = input() # S = input() S1 = input() S2 = input() S3 = input() # T = input() # N, K = map(int, input().split()) # N, M = map(int, input().split()) # N, Q = map(int, input().split()) # N, W = map(int, input().split()) # N, X = map(int, input().split()) # H, W = map(int, input().split()) # R, C = map(int, input().split()) # L, R = map(int, input().split()) # a, b = map(int, input().split()) # a, N = map(int, input().split()) # N, X, Y = map(int, input().split()) # N, A, B = map(int, input().split()) # A, B, K = map(int, input().split()) # N, M, K = map(int, input().split()) # V, A, B, C = map(int, input().split()) # A, B, C, D = map(int, input().split()) # A, B, C, X = map(int, input().split()) # N, M, K, S, T, X = map(int, input().split()) # A = list(map(int, input().split())) # C = list(map(int, input().split())) # H = list(map(int, input().split())) # T = list(map(int, input().split())) # P = list(map(lambda x: int(x) - 1, input().split())) # S = input() # Q = int(input()) # A = input().split() # S = input().split() # T = input().split() # N = list(input()) # S = list(input()) # X = [int(input()) for _ in range(N)] # X = [int(input()) for _ in range(Q)] # A = [input().split() for _ in range(N)] # A = [list(map(int, input().split())) for _ in range(N)] # A = [list(map(int, input().split())) for _ in range(H)] # G = [list(map(int, input().split())) for _ in range(M)] # querys = [list(map(int, input().split())) for _ in range(Q)] # querys = [input() for _ in range(Q)] # T = [list(map('.#'.index, input())) for _ in range(H)] # S = list(map('LR'.index, input())) # S = list(map('ULR'.index, input())) def main(): # import collections # import math # import queue # import random # import copy # import sys pass v = "" for S in [S1, S2, S3]: t = "" if v == S[0]: no() return v = S[0] for s in S: if t == s: no() return t = s yes() if __name__ == "__main__": main()