#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n;
    cin >> m;
    int a[n][2][2];
    for (int k = 0; k < n; k++) {
      for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 2; j++) {
          cin >> a[k][i][j];
        }
      }
    }
    if (m % 2 == 0) {
      bool b = 1;
      for (int i = 0; i < n; i++) {
        if ((a[i][0][1]) == a[i][1][0]) {
          b = 0;
          cout << "yes" << endl;
          break;
        }
      }
      if (b == 1) {
        cout << "no" << endl;
      }
    } else {
      cout << "no" << endl;
    }
  }
  return 0;
}
