#include #include #include #include #include #include #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; int b = 0; vector a(n); for (int j = 0; j < m; j++) { for (int i = 0; i < n; i++) { int t; cin >> t; a[i] += t; } int s = 0, h = 0, i = 0; for (;;) { if (s == 777) { b = 1; break; } if (s < 777) { if (i >= n) break; s += a[i++]; } if (s > 777) { s -= a[h++]; } } } cout << (b ? "YES" : "NO") << endl; return 0; }