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