#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; int n, m; ll sum[1005][1005],a[1005][1005],p[1005][1005]; int main(void){ cin >> n >> m; for (int i = 1; i <= m; i++) for (int j = 1; j <= n; j++) cin >> a[i][j]; for (int i = 0; i <= m; i++){ p[i][0] = 0; sum[i][0] = 0; } for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ p[j][i] = p[j - 1][i] + a[j][i]; } } for (int i = 1; i <= m; i++){ for (int j = 1; j <= n; j++){ sum[i][j] += sum[i][j - 1] + p[i][j]; } } for (int i = 1; i <= m; i++){ int l, r; l = r = 0; while (true){ if (sum[i][r] - sum[i][l] == 777){ cout << "YES" << endl; return 0; } if (sum[i][r] - sum[i][l] > 777){ l++; continue; } r++; if (r == n + 1) break; } } cout << "NO" << endl; }