#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " | ";
  err(++it, args...);
}
vector<long long int> v1, v2;
string s1, s2, s3;
set<long long int> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int a, b, c, d, e, f, i, j, k, m, n,
      cnt1 = 0, cnt2 = 0, sum1 = 0, sum2 = 0, chk1 = 0, chk2 = 0, T;
  cin >> T;
  while (T--) {
    v1.clear();
    cin >> a >> b;
    long long int chk = 0;
    for (i = 0; i < a; i++) {
      cin >> c >> d >> e >> f;
      if (d == e) {
        chk = 1;
      }
    }
    if (b % 2) {
      cout << "NO" << endl;
    } else {
      if (chk)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
  return 0;
}
