#include <bits/stdc++.h>
using namespace std;
string fun(int n, int m) {
  int i, j, k;
  k = 0;
  for (int t = 0; t < n; t++) {
    int a[2][2];
    for (i = 0; i < 2; i++) {
      for (j = 0; j < 2; j++) cin >> a[i][j];
    }
    if (a[0][1] == a[1][0]) k++;
  }
  if (m % 2 != 0) return "NO";
  if (k > 0) return "YES";
  return "NO";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int i, j, n, m;
    cin >> n >> m;
    cout << fun(n, m) << endl;
  }
}
