#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int test = 0; test < t; test++) {
    bool solved = false;
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < n; i++) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) solved = true;
    }
    if (m % 2 == 1) {
      cout << "NO" << endl;
      continue;
    }
    if (solved) {
      cout << "YES" << endl;
      continue;
    }
    cout << "NO" << endl;
  }
}
