#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const long long MOD = 1e9 + 7;
const long long mxN = 2e5 + 3;
const double EPS = 1e-9;
void solve() {
  long long n, m;
  cin >> n >> m;
  bool pr = false;
  long long a, b, c, d;
  for (long long i = 0; i < n; ++i) {
    cin >> a >> b;
    cin >> c >> d;
    if (b == c) pr = true;
  }
  if (m & 1) {
    cout << "NO\n";
  } else {
    if (pr)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long nT = 1;
  cin >> nT;
  for (long long i = 1; i <= nT; ++i) solve();
  return 0;
}
