#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class A, class B>
ostream& operator<<(ostream& os, const pair<A, B>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
template <class T>
auto operator<<(ostream& os, T&& x) -> decltype(x.begin(), os) {
  os << '{';
  for (auto it = x.begin(); it != x.end(); ++it)
    os << *it << (it == prev(x.end()) ? "" : ", ");
  return os << '}';
}
void dump() {}
template <class T, class... Args>
void dump(T&& x, Args... args) {
  cerr << x << ";  ";
  dump(args...);
}
int t, n, m;
void solve() {
  cin >> n >> m;
  bool ans = false;
  for (int i = 0; i < n; ++i) {
    int x, y, z, w;
    cin >> x >> y >> z >> w;
    if (y == z) ans = true;
  }
  if (m % 2 == 0 && ans)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios::sync_with_stdio(false);
  for (cin >> t; t--;) solve();
  return 0;
}
