N = 3 S = [input() for _ in range(N)] ans = "No" M = S[1][1] if S[0][0]==M and S[0][2]==M and S[0][1]!=M: if S[1][0]!=M and S[1][2]!=M: if S[2][0]==M and S[2][2]==M and S[2][1]!=M: ans="Yes" print(ans)