# import pypyjit # pypyjit.set_param('max_unroll_recursion=-1') import sys from itertools import combinations, permutations, product, accumulate, groupby from collections import defaultdict, deque, Counter from functools import reduce from operator import add, mul import heapq import bisect import math import copy sys.setrecursionlimit(10 ** 9) input = lambda: sys.stdin.readline().rstrip() INF = float("inf") MOD = 10 ** 9 + 7 N,M = map(int, input().split()) TRAIN = [0]*N ans = False for _ in range(M): L = list(map(int,input().split())) for i in range(N): TRAIN[i] += L[i] passenger=0 que = deque() for i in range(N): passenger += TRAIN[i] que.append(TRAIN[i]) while passenger > 777: passenger -= que.popleft() if passenger == 777: ans = True if ans: print('YES') else: print('NO')