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