#include <bits/stdc++.h>
using namespace std;
int solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> v(n, vector<int>(4));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 4; j++) {
      cin >> v[i][j];
    }
  }
  if (m % 2) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (v[i][1] == v[i][2]) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
}
