#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace atcoder; using namespace std; using ll = long long; using ull = unsigned long long; template using max_heap = priority_queue; template using min_heap = priority_queue, greater<>>; ll ll_min = numeric_limits::min(); ll ll_max = numeric_limits::max(); ll ALPHABET_N = 26; using mint = modint998244353; #define rep(i, n) for (ll i = (ll)0; i < (ll)n; i++) #define rep_(i, k, n) for (ll i = (ll)k; i < (ll)n; i++) #define all(a) a.begin(), a.end() int main() { vector> A(8, vector(8)); rep(i, 8) { string s; cin>>s; rep(j, 8) { A[i][j] = s[j] - '0'; } } vector tgt = A[0]; auto dfs = [&](auto &f, ll depth) -> bool { if (depth == 8) { return all_of(all(tgt), [](ll x) { return x == 0; }); } bool ret = false; rep(shift, 8) { vector tmp(8); rep(j, 8) { tmp[j] = A[depth][(j + shift) % 8]; } rep(j, 8) { tgt[j] -= tmp[j]; } if (f(f, depth + 1)) { ret = true; } rep(j, 8) { tgt[j] += tmp[j]; } if (ret) { break; } } return ret; }; if (dfs(dfs, 1)) { cout << "Yes" << endl; } else { cout << "No" << endl; } return 0; }