#!/usr/bin/env python nm = [int(x) for x in input().split()] indats = [] for i in range(nm[1]): tmpl = [int(x) for x in input().split()] indats.append(tmpl) npax = [0 for x in range(nm[0])] for indat in indats: npax = [x + y for (x, y) in zip(npax, indat)] for i in range(nm[0]): sumpax = 0 for j in range(nm[0]-i): sumpax += npax[i+j] if sumpax == 777: print('YES') exit() elif sumpax > 777: break else: continue print('NO')