#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int n, m, tl, tr, bl, br;
  bool bEven, bExistSym;
  while (t--) {
    cin >> n >> m;
    bEven = (m % 2 == 0);
    bExistSym = false;
    for (int i = 0; i < n; ++i) {
      cin >> tl >> tr;
      cin >> bl >> br;
      if (tr == bl) {
        bExistSym = true;
        continue;
      }
    }
    if (bEven && bExistSym)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
