import sys readline = sys.stdin.readline N, M = map(int, readline().split()) cur_num = [0 for x in range(N + 1)] done = False for _ in range(M): sum_val = 0 for i, num in enumerate(list(map(int, readline().split()))): sum_val += num cur_num[i + 1] += sum_val if done: continue for i in range(N): for j in range(i + 1, N + 1): if cur_num[j] - cur_num[i] == 777: done = True elif cur_num[j] - cur_num[i] > 777: break print('YES' if done else 'NO')