#include <bits/stdc++.h>
using namespace std;
template <typename... T>
inline void inp(T &...args) {
  ((cin >> args), ...);
}
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
  for (auto &x : a) in >> x;
  return in;
}
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T, U> &a) {
  in >> a.first >> a.second;
  return in;
}
void solve(int &T) {
  long long int n, m;
  cin >> n >> m;
  int ok = 0;
  for (long long int i = (0); i < (n); i += (1)) {
    vector<long long int> x(4);
    cin >> x;
    ok += (x[1] == x[2]);
  }
  if (m & 1) ok = 0;
  cout << ((ok > 0) ? "YES" : "NO") << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  cin >> t;
  for (int i = 1; i <= t; i++) {
    if (0) cerr << "Case #" << i << "\n";
    solve(i);
  }
  return 0;
}
