#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int x, y;
    cin >> x >> y;
    bool ok = false;
    int arr[2][2];
    for (int i = 0; i < x; i++) {
      for (int m = 0; m < 2; m++) {
        for (int j = 0; j < 2; j++) {
          cin >> arr[m][j];
        }
      }
      if (arr[0][1] == arr[1][0]) ok = true;
    }
    if (y % 2 == 0 && ok)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
