#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m;
    cin >> n >> m;
    long long int flag = 0;
    for (long long int i = 0; i < n; i++) {
      long long int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) flag = 1;
    }
    if (m % 2 == 1) {
      cout << "NO\n";
      continue;
    }
    if (flag) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
