#yuki_607 import sys n,m=map(int,raw_input().split()) a=[] for i in xrange(m): b=map(int,raw_input().split()) a.append(b) c=a[0] l,r=0,1 for i in range(n*2): s=sum(c[l:r]) if s==777: print 'YES' exit() elif s<777: r+=1 else: l+=1 if r>n: continue for i in xrange(1,m): for j in xrange(n): c[j]+=a[i][j] l,r=0,1 for i in range(n*2): s=sum(c[l:r]) if s==777: print 'YES' exit() elif s<777: r+=1 else: l+=1 if r>n: continue print 'NO'