#include <bits/stdc++.h>
using namespace std;
void fun() {
  int n, m;
  cin >> n >> m;
  vector<vector<vector<int>>> tiles(n, vector<vector<int>>(2, vector<int>(2)));
  vector<vector<int>> found;
  for (int i = 0; i < n; i++) {
    int x, y, u, v;
    cin >> x >> y >> u >> v;
    tiles[i] = {{x, y}, {u, v}};
    if (y == u) {
      found = {{x, y}, {u, v}};
    }
  }
  if (m % 2 == 1) {
    cout << "NO"
         << "\n";
    return;
  }
  if (found.size() == 0) {
    cout << "NO"
         << "\n";
    return;
  }
  cout << "YES"
       << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    fun();
  }
  return 0;
}
