#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int x = 0;
    long long int n, m;
    cin >> n >> m;
    for (long long int i = 0; i < n; i++) {
      long long int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c && m % 2 != 1 && x != 1) {
        cout << "Yes" << endl;
        x = 1;
      }
    }
    if (x == 0) cout << "No" << endl;
  }
}
