#include <bits/stdc++.h>
using namespace std;
long long ma(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long mi(long long a, long long b) {
  if (a < b) return a;
  return b;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    if (1) {
      long long f = 0;
      for (long long i = 0; i < n; i++) {
        long long a, b, c, d;
        cin >> a >> b >> c >> d;
        if (b == c) f = 1;
      }
      if (m % 2 == 1) f = 0;
      if (f == 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  }
}
