#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  cin >> q;
  while (q--) {
    long long int n;
    cin >> n;
    long long int x, y;
    int l, u, r, s;
    long long int nl = -100000, nu = 100000, nr = 100000, ns = -100000;
    for (long long int i = 0; i < n; i++) {
      cin >> x >> y >> l >> u >> r >> s;
      if (l == 0 && nl <= x) {
        nl = x;
      }
      if (u == 0 && nu >= y) {
        nu = y;
      }
      if (r == 0 && nr >= x) {
        nr = x;
      }
      if (s == 0 && ns <= y) {
        ns = y;
      }
    }
    if (ns <= nu && nl <= nr) {
      std::cout << 1 << " " << nl << " " << ns << std::endl;
    } else {
      std::cout << 0 << std::endl;
    }
  }
}
