#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
void solve() {
  int n, m;
  cin >> n >> m;
  int b = 0;
  for (int i = 0; i < n; i++) {
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (x2 == y1) {
      b = 1;
    }
  }
  if (m % 2 != 0 || b == 0) {
    cout << "NO"
         << "\n";
  } else {
    cout << "YES"
         << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
