N,M = map(int,input().split()) A = [list(map(int,input().split())) for _ in range(M)] B = [0 for _ in range(N)] flag = "NO" for i in range(M): for j in range(N): B[j] += A[i][j] cnt = 0 cur = 0 for j1 in range(N): if j1>0: cnt -= B[j1-1] if cnt==777: flag = "YES" break k = cur while k777: break k += 1 cur = k+1 if flag=="YES":break if cnt<777:break if flag=="YES":break print(flag)