#pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #include using namespace std; // #include // using namespace atcoder; // using mint = modint998244353; using ll = long long; #define fix(x) fixed << setprecision(x) #define rep(i, n) for(int i = 0; i < n; ++i) #define all(x) (x).begin(),(x).end() templatebool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;} templatebool chmax(T&a, const T&b){if(a> s; rep(j,8) a[i][j] = s[j]-'0'; } bool ans = false; rep(i,1<<21){ rep(j,8) b[j] = a[0][j]; rep(j,7)rep(k,8) b[k] -= a[j+1][(k+(i>>(j*3)))&7]; bool ok = true; rep(j,8) if(b[j]) ok = false; if(ok) ans = true; } cout << (ans?"Yes\n":"No\n"); return 0; }