s = input() s += input() s += input() for i in range(len(s)): if i%2 == 0 and s[i] != s[0]: print("No") break else: print("Yes")