#include <bits/stdc++.h>
using namespace std;
void output(bool b) {
  if (b == 1)
    cout << "yes\n";
  else
    cout << "no\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    bool f = 0;
    for (int i = 0; i < n; i++) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) f = 1;
    }
    if (m % 2 != 0) f = 0;
    output(f);
  }
}
