#include <bits/stdc++.h>   using namespace std;   int pic[610][610];   int ABS(int x) {     if (x < 0) return -x;     return x;   }   int main(int argc, char const *argv[]) {     int q;     scanf( %d , &q);     for (int i = 0; i < q; i++) {       int n, m, pix = 0, sum1 = 0, sum2 = 0;       scanf( %d%d , &n, &m);       for (int k = 0; k < n; k++)         for (int j = 0; j < m; j++) {           scanf( %d , &pic[k][j]);         }       int dif = 0;       for (int j = 0; j < m; j++)         dif = dif + ABS(pic[n / 2][j] - pic[n / 2 - 1][j]);       if (dif < 6000)         printf( NO n );       else         printf( YES n );     }     return 0;   }   