#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  int a, b, c, d, az, n, m;
  cin >> t;
  while (t--) {
    az = 0;
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
      cin >> a >> b;
      cin >> c >> d;
      if (b == c) az = 1;
    }
    if (m % 2 != 0)
      cout << "NO" << endl;
    else if (az == 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
