#include <bits/stdc++.h>
using namespace std;
long long fastpow(long long n, long long r) {
  if (r == 0) return 1;
  if (r == 1) return n;
  long long hr = fastpow(n, r / 2);
  if (r & 1)
    return (((hr * hr)) * n);
  else
    return (hr * hr);
}
long long inv(long long n) { return fastpow(n, 1000000007 - 2); }
long long multmod(long long n, long long m) {
  return ((n % 1000000007) * (m % 1000000007)) % 1000000007;
}
long long addmod(long long n, long long m) {
  return ((n % 1000000007) + (m % 1000000007)) % 1000000007;
}
long long submod(long long n, long long m) {
  return ((n % 1000000007) - (m % 1000000007) + 1000000007) % 1000000007;
}
long long divmod(long long n, long long m) {
  long long deno = inv(m);
  return multmod(n, deno);
}
long long StoI(string second) {
  stringstream shrey(second);
  long long x = 0;
  shrey >> x;
  return x;
}
string ItoS(long long n) {
  stringstream shrey;
  shrey << n;
  string ans;
  shrey >> ans;
  return ans;
}
long long pr[1000010];
void prime() {
  pr[0] = 1;
  pr[1] = 1;
  for (long long i = 2; i <= sqrt(1000010); i++) {
    for (long long j = 2 * i; j <= 1000010; j += i) {
      pr[j] = 1;
    }
  }
}
long long x[1000005], y[1000005], r[1000005], l[1000005], d[1000005],
    u[1000005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    multimap<long long, pair<long long, long long> > m1, m2;
    for (long long i = 0; i < n; i++) {
      cin >> x[i] >> y[i] >> l[i] >> u[i] >> r[i] >> d[i];
      m1.insert(make_pair(x[i], make_pair(l[i], r[i])));
      m2.insert(make_pair(y[i], make_pair(d[i], u[i])));
    }
    vector<long long> v1, v2, v3;
    for (multimap<long long, pair<long long, long long> >::iterator it =
             m1.begin();
         it != m1.end(); it++) {
      v1.push_back(it->first);
      v2.push_back(it->second.first);
      v3.push_back(it->second.second);
    }
    long long lbound = v1[0], rbound = v1[v1.size() - 1];
    for (long long i = v1.size() - 1; i >= 0; i--) {
      if (v2[i] == 0) {
        lbound = v1[i];
        break;
      }
    }
    for (long long i = 0; i < v1.size(); i++) {
      if (v3[i] == 0) {
        rbound = v1[i];
        break;
      }
    }
    if (lbound > rbound) {
      cout << 0 << "\n";
      continue;
    }
    long long ans1 = lbound;
    v1.clear();
    v2.clear();
    v3.clear();
    for (multimap<long long, pair<long long, long long> >::iterator it =
             m2.begin();
         it != m2.end(); it++) {
      v1.push_back(it->first);
      v2.push_back(it->second.first);
      v3.push_back(it->second.second);
    }
    lbound = v1[0], rbound = v1[v1.size() - 1];
    for (long long i = v1.size() - 1; i >= 0; i--) {
      if (v2[i] == 0) {
        lbound = v1[i];
        break;
      }
    }
    for (long long i = 0; i < v1.size(); i++) {
      if (v3[i] == 0) {
        rbound = v1[i];
        break;
      }
    }
    if (lbound > rbound) {
      cout << 0 << "\n";
      continue;
    }
    long long ans2 = lbound;
    cout << 1 << " " << ans1 << " " << ans2 << "\n";
  }
  return 0;
}
