#include <bits/stdc++.h>
using namespace std;
const long long siz = 1e2 + 10;
const long long SIZ = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long maxx = 2e9;
const long long MAXX = 1e18;
const string file = "2";
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n, m;
    cin >> n >> m;
    bool ans = false;
    for (long long i = 1; i <= n; i++) {
      long long a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) {
        ans = true;
      }
    }
    if (m % 2 != 0) {
      ans = false;
    }
    cout << ((ans) ? "YES" : "NO") << "\n";
  }
  return 0;
}
