#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m, p = 0, cnt = 0;
  cin >> n >> m;
  int a[n][2][2];
  while (p < n) {
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 2; j++) {
        cin >> a[p][i][j];
      }
    }
    if (a[p][0][1] == a[p][1][0]) {
      cnt++;
    }
    p++;
  }
  if (m % 2 == 0 && cnt != 0)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
