#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m, flag = 0;
  cin >> n >> m;
  vector<vector<int>> in;
  for (int i = 0; i < n; i++) {
    vector<int> temp;
    for (int j = 0; j < 4; j++) {
      int sz;
      cin >> sz;
      temp.push_back(sz);
    }
    in.push_back(temp);
  }
  if (m % 2 == 1)
    cout << "NO";
  else {
    for (int i = 0; i < n; i++) {
      if (in[i][1] == in[i][2]) flag = 1;
      if (flag == 1) {
        cout << "YES";
        break;
      }
    }
    if (flag == 0) cout << "NO";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
