void main(){ import std.stdio, std.string, std.conv, std.algorithm; import std.random; int n, m; rd(n, m); auto d=new int[][](m, n); foreach(i; 0..m) d[i]=readln.split.to!(int[]); writeln(solve(n, m, d)?"YES":"NO"); } bool solve(int n, int m, int[][] d){ auto a=new int[](n); int tg=777; foreach(i; 0..m){ foreach(j; 0..n) a[j]+=d[i][j]; auto sum=0, l=0, r=0; while(rtg) sum-=a[l++]; if(sum==tg) return true; } } return false; } bool greedy(int n, int m, int[][] d){ import std.algorithm.iteration:sum; auto a=new int[](n); foreach(i; 0..m){ foreach(j; 0..n) a[j]+=d[i][j]; foreach(l; 0..n)foreach(r; l..n){ auto s=sum(a[l..(r+1)]); if(s==777) return true; } } return false; } 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; }