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