#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int w, h; cin >> w >> h; vector A(w); for(int y = 0; y < h; y++){ for(int x = 0, v; x < w; x++){ cin >> v; A[x] += v; } for(int l = 0, r = 0, s = 0; l < w; l++){ while(r < w && s < 777)s += A[r++]; if(s == 777){ cout << "YES" << '\n'; return 0; } s -= A[l]; } } cout << "NO" << '\n'; }