#include using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,a) for(int i=0;i<(a);i++) #define MOD 1000000007 int a[1000]; int main(){ int N,M;cin>>N>>M; rep(i,M){ rep(j,N){ int x; cin>>x; a[j]+=x; } int l=0,sum=0; rep(j,N){ if(sum<777){ sum+=a[j]; } while(sum>777){ sum-=a[l]; l++; } if(sum==777){ cout<<"YES"<