#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n, m;
    cin >> n >> m;
    bool fl = true;
    if (m % 2 == 1) fl = false;
    bool flag = false;
    for (int i = 0; i < n; i++) {
      int cur, x, y;
      cin >> cur >> x >> y >> cur;
      if (x == y) flag = true;
    }
    if (!flag || !fl)
      cout << "NO" << '\n';
    else
      cout << "YES" << '\n';
  }
}
