#include <bits/stdc++.h>
using namespace std;
const long long INF64 = 1e18;
clock_t time_p = clock();
void time() {
  time_p = clock() - time_p;
  cerr << "Time Taken : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
void doc() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
bool isprime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
void solve() {
  int n, m, i, j;
  cin >> n >> m;
  bool flag = false;
  while (n--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b == c) flag = true;
  }
  if (m & 1) {
    cout << "NO\n";
    return;
  }
  cout << (flag ? "YES" : "NO") << '\n';
}
int main() {
  fast();
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
