#include #include #include #include #include int main(void) { int i, j; int n, m; int64_t a[1010]; int64_t b[1010]; scanf("%d%d", &n, &m); for (i = 0; i <= n; i++) { a[i] = 0; } for (j = 0; j < m; j++) { for (i = 0; i < n; i++) { scanf("%" PRIi64, &b[i]); } for (i = 0; i < n; i++) { a[i] += b[i]; } int64_t l = 0, r = 0, s = 0; while (l < n) { while ((r < n) && (s < 777)) { s += a[r]; r++; } if (s == 777) { printf("YES\n"); return 0; } s -= a[l]; l++; } } printf("NO\n"); return 0; }