#include using namespace std; using ll = long long; int main(){ int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int nh, nw; bool f=1; vector S(3); for (int i=0; i<3; i++) cin >> S[i]; for (int h=0; h<3; h++){ for (int w=0; w<3; w++){ for (int i=0; i<4; i++){ nh = h+dx[i]; nw = w+dy[i]; if (nh < 0 || nh >= 3 || nw < 0 || nw >= 3) continue; if (S[h][w] == S[nh][nw]) f=0; } } } cout << (f ? "Yes" : "No") << endl; return 0; }