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