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