#include <bits/stdc++.h>
using namespace std;
const int A = 1e2 + 2;
const int mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, m;
    cin >> n >> m;
    bool valid = 0;
    for (int i = 0; i < n; i++) {
      int a, b, c, d;
      cin >> a >> b >> c >> d;
      if (b == c) valid = 1;
    }
    if (m % 2 == 0 && valid)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
