#include <bits/stdc++.h>
using namespace std;
template <class T>
void mns(T &a, T b) {
  a = min(a, b);
}
template <class T>
void mxs(T &a, T b) {
  a = max(a, b);
}
void Main();
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    Main();
  }
}
void Main() {
  int n, m;
  cin >> n >> m;
  bool f = 0;
  for (int x = 0; x < n; ++x) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b == c) {
      f = 1;
    }
  }
  if (m & 1) {
    cout << "NO\n";
    return;
  }
  if (!f) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
}
