#include <bits/stdc++.h>
using namespace std;
void DBG() { cerr << "]\n"; }
template <typename T, typename... Args>
void DBG(T first, Args... args) {
  cerr << first;
  if (sizeof...(args)) cerr << ", ";
  DBG(args...);
}
void solve() {
  long long int n, m;
  cin >> n >> m;
  long long int a[n][2][2];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < 2; j++) {
      for (long long int k = 0; k < 2; k++) {
        cin >> a[i][j][k];
      }
    }
  }
  if (m & 1) {
    cout << "NO\n";
    return;
  }
  for (long long int i = 0; i < n; i++) {
    if (a[i][0][1] == a[i][1][0]) {
      cout << "YES\n";
      return;
    }
  }
  cout << "NO\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t = 1;
  cin >> t;
  for (long long int tt = 1; tt <= t; tt++) {
    solve();
  }
}
