#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  long long int t = 1;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int tiles[n][2][2];
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < 2; j++) {
        for (long long int k = 0; k < 2; k++) {
          cin >> tiles[i][j][k];
        }
      }
    }
    if (m % 2) {
      cout << "NO" << endl;
      continue;
    }
    bool flag = false;
    for (long long int i = 0; i < n; i++) {
      if (tiles[i][1][0] == tiles[i][0][1]) {
        flag = true;
        break;
      }
    }
    if (flag)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
