#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
int ctoi(char c) { return c - '0'; }
int slen(string s) { return s.length(); }
int vsize(vi a) { return (int)a.size(); }
int in() {
  int x;
  cin >> x;
  return x;
}
void solve() {
  ll n, m, res, x1, y1, c = 0, x2, y2;
  cin >> n >> m;
  map<ll, ll> mp;
  ll u = 2 * n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2;
    if (y1 == x2) c++;
  }
  if (m % 2 == 0 && c >= 1)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ll t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
