S="" for i in range(3): S+=input().strip() s=S[0] print("Yes" if all([ss!=s for ss in S[1::2]]+[ss==s for ss in S[2::2]]) else "No")