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