#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int i;
  long long int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int p, q, r, second;
    bool flag = false;
    for (i = 0; i < n; i++) {
      cin >> p >> q >> r >> second;
      if (q == r && flag == false) {
        flag = true;
      }
    }
    if (m % 2 != 0) {
      cout << "NO" << endl;
      continue;
    }
    if (flag == false) {
      cout << "NO" << endl;
    } else {
      cout << "YES" << endl;
    }
  }
  return 0;
}
