#include <bits/stdc++.h>
using namespace std;
long long t = 1, n, m, k, sum, c, l, r, d, mx = -1e9, h, j, mn = 1e9, sum1,
          sum2, i, f, x;
long long a[1111117], b[1111117];
string s, u, w;
vector<long long> d1;
vector<long long> d2;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    k = 0;
    for (int i = 1; i <= n; ++i) {
      cin >> c >> l;
      cin >> r >> d;
      if (r == l) k++;
    }
    if (k == 0 || m % 2 == 1)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
