#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int tcase;
  cin >> tcase;
  while (tcase--) {
    int n, m;
    bool ok = false;
    cin >> n >> m;
    while (n--) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) ok = true;
    }
    if ((m & 1) || !ok)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
  return 0;
}
