#include using namespace std; using ll = long long; bool solve(int n, int m) { vector a(n, 0); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { int tmp; cin >> tmp; a[j] += tmp; } int sum = 0; for (int j = 0, k = 0; j < n; j++) { if (sum == 777) return true; while (k < n) { sum += a[k]; k++; if (sum > 777) break; if (sum == 777) return true; } if (k == n) break; sum -= a[j]; } } return false; } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; cout << (solve(n, m) ? "YES" : "NO") << endl; return 0; }