#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); vector S(3, vector(3)); rep(i, 0, 3) rep(j, 0, 3) cin >> S[i][j]; bool ok = true; rep(i, 0, 3) rep(j, 0, 2) if (S[i][j] == S[i][j + 1]) ok = false; rep(i, 0, 2) rep(j, 0, 3) if (S[i][j] == S[i + 1][j]) ok = false; cout << (ok ? "Yes\n" : "No\n"); }