#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, m, e = 0;
    cin >> n >> m;
    for (long long int i = 0; i < n; i++) {
      long long int a, b, c, d;
      cin >> a >> b;
      cin >> c >> d;
      if (b == c) e = 1;
    }
    if (m % 2 != 0)
      cout << "NO" << endl;
    else {
      if (e == 0)
        cout << "NO" << endl;
      else
        cout << "YES" << endl;
    }
  }
}
