n, m = list(map(int, input().split())) l = [0 for _ in range(n)] f = False for i in range(m): l_i = [int(i) for i in input().split()] l = [(l[b] + l_i[b]) for b in range(n)] right = 1 left = 0 num = l[left] while right <= n - 1: num += l[right] right += 1 if num > 777: left += 1 right = left + 1 num = l[left] f2 = False continue if num == 777: f = True break if num == 777: f = True break if f: print('YES') else: print('NO')