#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, a, b, c, d, poz, ok;
  cin >> n;
  poz = 0;
  ok = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    for (int j = 0; j < x; j++) {
      cin >> a >> b >> c >> d;
      if (b == c) ok = 1;
    }
    if (ok == 1 && y % 2 == 0)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
    ok = 0;
  }
  return 0;
}
