import sys N, M = map(int, sys.stdin.read().split()) sums = [0 for _ in range(N)] nums = [0 for _ in range(N + 1)] done = False for _ in range(M): num = 0 nums[0] = 0 for i, n in enumerate(map(int, sys.stdin.read().split())): sums[i] += n nums[i + 1] = sums[i] + num num += sums[i] for j in range(0, i + 1): if nums[i + 1] - nums[j] == 777: done = True if done: print('YES') else: print('NO')