S1 = input() S2 = input() S3 = input() S = S1 + S2 + S3 def IsAlternating(S): if len(S) < 1: return False elif len(S) == 1: return True elif len(list(set(list(S)))) != 2: return False else: FirstCharacter = S[0] SecondCharacter = S[1] for i in range(0, len(S)): if i % 2 == 0 and S[i] != FirstCharacter: return False elif i % 2 == 1 and S[i] != SecondCharacter: return False return True if IsAlternating(S): print("Yes") else: print("No")