#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  bool flag = false;
  for (int i = 0; i < n; i++) {
    int one, two, three, four;
    cin >> one >> two >> three >> four;
    if (two == three && (m % 2) == 0) {
      flag = true;
    }
  }
  if (flag)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int testcases;
  cin >> testcases;
  for (int i = 0; i < testcases; i++) {
    solve();
  }
  return 0;
}
