void main(){ import std.stdio, std.string, std.conv, std.algorithm; int n, m; rd(n, m); auto d=new int[][](m, n); foreach(i; 0..m) d[i]=readln.split.to!(int[]); auto a=new int[](n); int tg=777; bool ok=false; foreach(i; 0..m){ a[]+=d[i][]; int s=0; foreach(l; 0..n)foreach(r; l..n){ for(int k=l; k<=r; k++){ if((s+=a[k])==tg){writeln("YES"); return;} } } } writeln("NO"); } void rd(T...)(ref T x){ import std.stdio, std.string, std.conv; auto l=readln.split; assert(l.length==x.length); foreach(i, ref e; x){ e=l[i].to!(typeof(e)); } } void wr(T...)(T x){ import std.stdio; foreach(e; x) stderr.write(e, " "); stderr.writeln; }