#include <bits/stdc++.h>
using namespace std;
void _print(long long t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(long double t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(unsigned long long t) { cerr << t; }
template <class T, class V>
void _print(pair<T, V> p);
template <class T>
void _print(vector<T> adj);
template <class T>
void _print(set<T> adj);
template <class T, class V>
void _print(map<T, V> adj);
template <class T>
void _print(multiset<T> adj);
template <class T, class V>
void _print(pair<T, V> p) {
  cerr << "{";
  _print(p.first);
  cerr << ",";
  _print(p.second);
  cerr << "}";
}
template <class T>
void _print(vector<T> adj) {
  cerr << "[ ";
  for (T i : adj) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(set<T> adj) {
  cerr << "[ ";
  for (T i : adj) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T>
void _print(multiset<T> adj) {
  cerr << "[ ";
  for (T i : adj) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(map<T, V> adj) {
  cerr << "[ ";
  for (auto i : adj) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
template <class T, class V>
void _print(unordered_map<T, V> adj) {
  cerr << "[ ";
  for (auto i : adj) {
    _print(i);
    cerr << " ";
  }
  cerr << "]";
}
vector<int> sieve(int n) {
  int* arr = new int[n + 1]();
  vector<int> vect;
  for (int i = 2; i <= n; i++)
    if (arr[i] == 0) {
      vect.push_back(i);
      for (int j = 2 * i; j <= n; j += i) arr[j] = 1;
    }
  return vect;
}
long long mod_add(long long a, long long b, long long m) {
  a = a % m;
  b = b % m;
  return (((a + b) % m) + m) % m;
}
long long mod_mul(long long a, long long b, long long m) {
  a = a % m;
  b = b % m;
  return (((a * b) % m) + m) % m;
}
long long mod_sub(long long a, long long b, long long m) {
  a = a % m;
  b = b % m;
  return (((a - b) % m) + m) % m;
}
const int N = 2 * 1e5 + 10;
void solve() {
  int n, m;
  cin >> n >> m;
  int f = 0;
  while (n--) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (b == c) f = 1;
  }
  if (m % 2 == 0 and f)
    cout << "YES\n";
  else
    cout << "NO\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  for (long long tc = 1; tc < t + 1; tc++) {
    solve();
  }
}
