#include #define rep(i, n) for(int i = 0; i < (n); ++i) using namespace std; using ll = long long; using P = pair; int main(void){ int n, m; cin >> n >> m; vector a(n); rep(i, m){ rep(j, n){ int num; cin >> num; a[j] += num; } a.push_back(0); int sum = a[0], l, r; l = r = 0; while(r < n){ if(sum == 777){ cout << "YES" << endl; return 0; } else if(sum < 777){ ++r; sum += a[r]; } else { sum -= a[l]; ++l; } } } cout << "NO" << endl; return 0; }