#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m, k, a, b, c, d, t;
  cin >> t;
  for (long long w = 0; w < t; w++) {
    cin >> n;
    long long cord1 = -100000, cord2 = 100000, cord3 = 100000, cord4 = -100000,
              q = 1;
    for (long long i = 0; i < n; i++) {
      cin >> m >> k >> a >> b >> c >> d;
      if (a == 0) {
        cord1 = max(cord1, m);
      }
      if (c == 0) {
        cord3 = min(cord3, m);
      }
      if (b == 0) {
        cord2 = min(cord2, k);
      }
      if (d == 0) {
        cord4 = max(cord4, k);
      }
    }
    if (q == 0 || cord1 > cord3 || cord4 > cord2)
      cout << 0 << endl;
    else
      cout << 1 << " " << cord1 << " " << cord4 << endl;
  }
  return 0;
}
