#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t, n, m;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
      long long a, b, c, d;
      cin >> a >> b;
      cin >> c >> d;
      if (b == c) {
        cnt++;
      }
    }
    if (cnt && m % 2 == 0) {
      cout << "YES"
           << "\n";
    } else {
      cout << "NO"
           << "\n";
    }
  }
}
