#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a, b, c, d;
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b >> c >> d;
    if (b == c) count++;
  }
  if (m % 2 == 0 and count > 0) {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
  }
}
