#include using namespace std; typedef pair pii; typedef long long ll; const int N = 2000086, MOD = 998244353, INF = 0x3f3f3f3f; ll res; int n, m, cnt, w[N]; int a[9][9], c[9]; void dfs(int idx) { if (idx == 9) { for (int i = 1; i < n + 1; i++) if (a[1][i] != c[i]) return; puts("Yes"); exit(0); } for (int i = 1; i <= n; i++) { int t = 0, ne = i; while (t++ != 8) { c[t] += a[idx][ne]; ne = ne == 8 ? 1 : ne + 1; } for (int j = 1; j < n + 1; j++) if (a[1][j] < c[j]) goto NE; dfs(idx + 1); NE:; t = 0, ne = i; while (t++ != 8) { c[t] -= a[idx][ne]; ne = ne == 8 ? 1 : ne + 1; } } } int main() { n = 8; for (int i = 1; i < n + 1; i++) { string s; cin >> s; for (int j = 1; j < n + 1; j++) a[i][j] = s[j - 1] - '0'; } dfs(2); puts("No"); return 0; }