n,m = map(int,raw_input().split()) arr = [map(int,raw_input().split()) for i in range(m)] for i in range(1,m): for j in range(n): arr[i][j] = arr[i-1][j] + arr[i][j] for i in range(m): l = 0 r = 0 ans = arr[i][l] while l < n : if ans == 777: print 'YES' quit() if r + 1 < n and ans + arr[i][r+1] <= 777: r += 1 ans += arr[i][r] else : l += 1 r = l if l < n : ans = arr[i][l] print 'NO'