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