#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m, p, q, r, s;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    int c = 0, d = 0;
    if (m % 2 != 0) c++;
    while (n--) {
      cin >> p >> q;
      cin >> r >> s;
      if (r == q) d++;
    }
    if (c == 0 && d != 0)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
