#include <bits/stdc++.h>
using namespace std;
void Void() {
  int n, m, a = 0, b = 0;
  cin >> n >> m;
  if (m % 2 == 0) {
    a = 1;
  }
  for (int i = 0; i < n; i++) {
    int x, y, z, w;
    cin >> x >> y >> z >> w;
    if (z == y) {
      b = 1;
    }
  }
  if (a == 1 && b == 1) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    Void();
    cout << endl;
  }
}
