#include <bits/stdc++.h>
using namespace std;
long long M = 1000000007;
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long power(long long base, long long n) {
  if (n == 0) return 1;
  if (n == 1) return base;
  long long halfn = power(base, n / 2);
  if (n % 2 == 0)
    return (halfn * halfn) % M;
  else
    return (((halfn * halfn) % M) * base) % M;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  bool x = 0;
  for (long long i = 0; i < n; i++) {
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    if (c == b) {
      x = 1;
    }
  }
  if (m & 1) {
    cout << "NO\n";
    return;
  }
  if (x)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  fast();
  long long tt;
  cin >> tt;
  while (tt--) {
    solve();
  }
  return 0;
}
