#include <bits/stdc++.h>
using namespace std;
void INP();
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  if (0) return;
  cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  if (0) return;
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
void alpha() {
  long long int n;
  cin >> n;
  pair<long long int, long long int> arr[n];
  long long int actions[n][4];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
    for (long long int j = 0; j < 4; j++) cin >> actions[i][j];
  }
  long long int atleast_y = -100000, atmost_y = 100000, atleast_x = -100000,
                atmost_x = 100000;
  for (long long int i = 0; i < n; i++) {
    if (actions[i][0] and actions[i][1] and actions[i][2] and actions[i][3])
      continue;
    else {
      if (actions[i][0] == 0) {
        if (arr[i].first > atmost_x) {
          cout << 0 << '\n';
          return;
        } else if (arr[i].first > atleast_x)
          atleast_x = arr[i].first;
      }
      if (actions[i][1] == 0) {
        if (arr[i].second < atleast_y) {
          cout << 0 << '\n';
          return;
        } else if (arr[i].second < atmost_y)
          atmost_y = arr[i].second;
      }
      if (actions[i][2] == 0) {
        if (arr[i].first < atleast_x) {
          cout << 0 << '\n';
          return;
        } else if (arr[i].first < atmost_x)
          atmost_x = arr[i].first;
      }
      if (actions[i][3] == 0) {
        if (arr[i].second > atmost_y) {
          cout << 0 << '\n';
          return;
        } else if (arr[i].second > atleast_y)
          atleast_y = arr[i].second;
      }
    }
  }
  if (atleast_y > atmost_y or atleast_x > atmost_x) {
    cout << 0 << '\n';
    return;
  }
  cout << 1 << " " << atleast_x << " " << atleast_y << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  INP();
  long long int t = 1;
  cin >> t;
  while (t--) alpha();
  return 0;
}
inline void INP() {}
