#include <bits/stdc++.h>   using namespace std;   const int INF = 2 * int(1e9);   const long long INFll = 1ll * int(1e9) * int(1e9);   const int MOD = 1000000007;   template <typename T>   ostream& operator<<(ostream& out, pair<T, T>& a) {     out << a.first <<     << a.second;     return out;   }   template <typename T>   istream& operator>>(istream& in, pair<T, T>& a) {     in >> a.first >> a.second;     return in;   }   template <typename T>   ostream& operator<<(ostream& out, vector<pair<T, T> > a) {     for (int i = 0; i < a.size(); ++i) out << a[i] << endl;     return out;   }   template <typename T>   istream& operator>>(istream& in, vector<T>& a) {     for (int i = 0; i < a.size(); ++i) in >> a[i];     return in;   }   template <typename T>   ostream& operator<<(ostream& out, vector<T> a) {     for (int i = 0; i < a.size(); ++i)       if (i == a.size() - 1)         out << a[i];       else         out << a[i] <<    ;     return out;   }   struct IN {     bool any;     operator bool() const { return any; }   } CIN;   inline IN& operator>>(IN& in, int& x) {     x = 0, in.any = 0;     char c;     while ((c = getchar()) > 0) {       if (c < 48 || c > 57)         if (in.any)           return in;         else           continue;       in.any = 1, x = x * 10 + c -  0 ;     }     return in;   }   int main() {     ios_base::sync_with_stdio(0);     int q;     CIN >> q;     while (q--) {       int n, m;       CIN >> n >> m;       vector<vector<int> > a(n, vector<int>(m));       for (int i = 0; i < n; ++i)         for (int j = 0; j < m; ++j) CIN >> a[i][j];       int sum = 0;       for (int j = 0; j < m; ++j) sum += abs(a[n / 2][j] - a[n / 2 - 1][j]);       if (sum / long double(m) > 17)         cout <<  YES n ;       else         cout <<  NO n ;       if (0) cerr << sum / long double(m) << endl;     }     if (0)       cerr << fixed << setprecision(0)            <<  TIME =   << clock() / (long double)CLOCKS_PER_SEC * 1000 <<   n ;     return 0;   }   