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