#pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using ll = long long; const int INF = 1e9; const ll inf = 1LL<<60; void solve() { vector s(3); cin >> s[0] >> s[1] >> s[2]; vector dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1}; for (int i=0; i<3; i++) for (int j=0; j<3; j++) { for (int k=0; k<4; k++) { int nx = i + dx[k], ny = j + dy[k]; if (0 <= nx && nx < 3 && 0 <= ny && ny < 3) { if (s[i][j] == s[nx][ny]) { cout << "No" << '\n'; return; } } } } cout << "Yes" << '\n'; } int main() { ios::sync_with_stdio(false); std::cin.tie(nullptr); // int t; cin >> t; /*while (t--)*/ solve(); }