#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9L + 7;
const long long INF = 1e18L + 5;
const long long mxN = 2e5 + 1;
long long n, m;
void solve() {
  cin >> n >> m;
  bool ok = 0;
  long long a, b, c, d;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    ok |= (b == c);
  }
  if (ok && (m % 2 == 0))
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  cin >> t;
  for (long long tt = 1; tt <= t; tt++) solve();
  return 0;
}
