from collections import deque N,M=map(int,input().split()) flag=0 S=[0]*N for i in range(M): A=list(map(int,input().split())) for i in range(N): S[i]+=A[i] SUM=0 Q=deque() for i in range(N): Q.append(S[i]) SUM+=S[i] while SUM>777: k=Q.popleft() SUM-=k if SUM==777: flag=1 if flag==1: print("YES") else: print("NO")