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