#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    bool temp = false;
    for (int i = 0; i < n; ++i) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) temp = true;
    }
    if (m % 2 != 0) {
      cout << "NO\n";
      continue;
    }
    if (temp == true)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
