#include <bits/stdc++.h>
using namespace std;
long long dx[8] = {+1, +1, +1, 0, 0, -1, -1, -1};
long long dy[8] = {+1, 0, -1, +1, -1, +1, 0, -1};
long long dx4[4] = {+1, -1, +0, +0};
long long dy4[4] = {0, 0, +1, -1};
void input_File() {}
bool isPrime(long long n) {
  if (n <= 1) return false;
  for (long long i = 2; i < n; i++)
    if (n % i == 0) return false;
  return true;
}
long long sumofdigits(long long n) {
  long long c = 0;
  while (n > 0) {
    c++;
    n /= 10;
  }
  return c;
}
long long MaxSubArraySumReturn(long long a[], long long n) {
  long long sum = 0, best = 0;
  for (long long i = 0; i < n; i++) {
    sum = max(a[i], a[i] + sum);
    best = max(best, sum);
  }
  return best;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 2; i <= n; i++) res = res * i;
  return res;
}
long long nCr(long long n, long long r) {
  return fact(n) / (fact(r) * fact(n - r));
}
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.first > b.first);
}
long long countDivisors(long long n) {
  long long cnt = 0;
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
long long setBitCount(long long n) {
  long long ans = 0;
  while (n) n &= n - 1, ans++;
  return ans;
}
long long power(long long a, long long b) {
  long long result = 1;
  while (b) {
    if (b & 1) {
      result *= a;
      b--;
    } else {
      a *= a;
      b >>= 1;
    }
  }
  return result;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a1, b1, a2, b2;
  bool flag = false;
  for (long long i = 0; i < n; i++) {
    cin >> a1 >> b1 >> a2 >> b2;
    if (a2 == b1) flag = true;
  }
  if ((m & 1) or !flag)
    cout << "NO\n";
  else
    cout << "YES\n";
}
signed main() {
  input_File();
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long isTestCasePresent = 1;
  if (isTestCasePresent == 0) {
    long long t = 1;
    while (t--) {
      solve();
    }
  } else {
    long long t;
    cin >> t;
    while (t--) {
      solve();
    }
  }
  return 0;
}
