#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 0, n = 0, m = 0, a = 0, b = 0, c = 0, d = 0;
  cin >> t;
  while (t--) {
    cin >> n >> m;
    bool flag = false;
    for (int i = 0; i < n; ++i) {
      cin >> a >> b >> c >> d;
      if (b == c) flag = true;
    }
    if (m & 1) flag = false;
    cout << (flag ? "YES\n" : "NO\n");
  }
}
