#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> adj;
map<long, bool> vis, viss;
vector<long long> rnk, parent, sz;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, temp;
  cin >> t;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    map<vector<long long>, long long> mp;
    long long a, b, c, d;
    string s = "NO";
    for (long long i = 0; i < n; i++) {
      cin >> a >> b >> c >> d;
      if (c == b) s = "YES";
    }
    if (m % 2 != 0) s = "NO";
    cout << s << endl;
  }
  return 0;
}
