#include <bits/stdc++.h>
using namespace std;
int main() {
  int C;
  cin >> C;
  while (C > 0) {
    int n, N, x;
    int c = 0;
    cin >> n >> N;
    int A[2][2];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < 2; j++) {
        for (int k = 0; k < 2; k++) {
          cin >> x;
          A[j][k] = x;
        }
      }
      if (c == 0) {
        if (A[0][1] == A[1][0]) c = 1;
      }
    }
    if (c == 1 && N % 2 == 0)
      cout << "YES"
           << "\n";
    else
      cout << "NO\n";
    C--;
  }
  return 0;
}
