#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    int a[n], b[n], c[n], d[n];
    int pos = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i] >> b[i] >> c[i] >> d[i];
      if (b[i] == c[i]) {
        pos++;
      }
    }
    if (m % 2 == 0) {
      if (pos) {
        cout << "YES\n";
      } else {
        cout << "NO\n";
      }
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
