#include <bits/stdc++.h>
using namespace std;
void init_code() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const double EPSILON = 10e-8;
bool equal(double a, double b) { return fabs(a - b) < EPSILON; }
bool less(double a, double b) { return a < b && !equal(a, b); }
long long fast_power(long long base, long long power) {
  if (power == 0) return 1;
  if (power == 1) return base;
  long long result = fast_power(base, power / 2) % 1000000007;
  if (power % 2 == 0) return (result * result) % 1000000007;
  return (result * base * result) % 1000000007;
}
int main() {
  init_code();
  long long t;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    bool flag = false;
    while (n--) {
      long long preva, prevb, a, b;
      cin >> preva >> prevb;
      cin >> a >> b;
      if (prevb == a) {
        flag = 1;
      }
    }
    if (flag && m % 2 == 0) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
}
