#include using namespace std; using ll = long long; using vi = vector; using vll = vector; using vvi = vector; using vvll = vector; using vvvll = vector; using vs = vector; const int IntINF = 1 << 30; const ll LLINF = 1LL << 60; #define REP(i, a, n) for (ll i = (a); i < (ll)(n); ++i) #define rep(i, n) REP(i, 0, n) #define what_is(x) cerr << #x << " is " << x << endl; template ostream &operator<<(ostream &os, const pair &p) { os << p.first << " " << p.second; return os; } template ostream &operator<<(ostream &os, const vector &v) { rep(i, v.size()) { os << v[i] << (i < (ll)v.size() - 1 ? " " : ""); } return os; } template ostream &operator<<(ostream &os, const vector> &v) { rep(i, v.size()) { rep(j, v[i].size()) { os << v[i][j] << (j < (ll)v[i].size() - 1 ? " " : ""); } os << endl; } return os; } template ostream &operator<<(ostream &os, const map &v) { for (const auto &p : v) { os << p.first << ": " << p.second << endl; } return os; } inline void io_setup(int precision = 15) { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(precision); cerr << fixed << setprecision(precision); } int main() { io_setup(); int N, M; cin >> N >> M; vvll A(M, vll(N)); rep(i, M) rep(j, N) cin >> A[i][j]; REP(i, 1, M) { rep(j, N) { A[i][j] += A[i - 1][j]; } } vvll sum(M, vll(N + 1)); rep(i, M) { rep(j, N) { sum[i][j + 1] = sum[i][j] + A[i][j]; } } rep(i, M) { rep(j, N + 1) { auto l_iter = sum[i].begin() + j; bool found = binary_search(l_iter, sum[i].end(), 777 + sum[i][j]); if (found) { cout << "YES" << endl; return 0; } } } cout << "NO" << endl; return 0; }