#include <bits/stdc++.h>
const int MAX_N = (int)1e5 + 123;
const long long inf = (long long)7e18 + 123;
using namespace std;
int n;
struct Point {
  long long x, y, z;
} a[MAX_N];
pair<long long, long long> t[4], first[4];
long long val[3];
long long up(long long x) {
  if (x >= 0) return x / 2 + x % 2;
  return x / 2;
}
long long down(long long x) {
  if (x >= 0 || x % 2 == 0) return x / 2;
  return x / 2 - 1;
}
bool check(long long len, Point &best) {
  for (int i = 0; i < 4; i++) t[i] = make_pair(-inf, inf);
  for (int i = 1; i <= n; i++) {
    t[0].first = max(t[0].first, a[i].x + a[i].y + a[i].z - len);
    t[0].second = min(t[0].second, a[i].x + a[i].y + a[i].z + len);
    t[1].first = max(t[1].first, a[i].x + a[i].y - a[i].z - len);
    t[1].second = min(t[1].second, a[i].x + a[i].y - a[i].z + len);
    t[2].first = max(t[2].first, a[i].x - a[i].y + a[i].z - len);
    t[2].second = min(t[2].second, a[i].x - a[i].y + a[i].z + len);
    t[3].first = max(t[3].first, -a[i].x + a[i].y + a[i].z - len);
    t[3].second = min(t[3].second, -a[i].x + a[i].y + a[i].z + len);
  }
  for (int i = 0; i < 4; i++)
    if (t[i].first > t[i].second) return 0;
  for (int r = 0; r < 2; r++) {
    first[0] = make_pair(t[0].first - 3 * r, t[0].second - 3 * r);
    for (int i = 1; i < 4; i++)
      first[i] = make_pair(t[i].first - r, t[i].second - r);
    bool bad = 0;
    for (int i = 0; i < 4; i++) {
      first[i].first = up(first[i].first),
      first[i].second = down(first[i].second);
      if (first[i].first > first[i].second) {
        bad = 1;
        break;
      }
    }
    if (bad) continue;
    for (int i = 1; i < 4; i++) val[i - 1] = first[i].first;
    if (0.0 + val[0] + val[1] + val[2] > 0.0 + first[0].second) continue;
    long long need = max(0ll, first[0].first - val[0] - val[1] - val[2]);
    for (int i = 1; i < 4; i++) {
      long long add = min(need, first[i].second - val[i - 1]);
      val[i - 1] += add;
      need -= add;
    }
    if (need) continue;
    best =
        Point({val[0] + val[1] + r, val[0] + val[2] + r, val[1] + val[2] + r});
    return 1;
  }
  return 0;
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y >> a[i].z;
  long long l = 0, r = (long long)3e18 + 123, mid, ans = -1;
  Point res;
  while (l <= r) {
    mid = (l + r) / 2;
    if (check(mid, res)) {
      ans = mid;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  assert(ans != -1);
  check(ans, res);
  cout << res.x << ' ' << res.y << ' ' << res.z << '\n';
}
int main() {
  ios_base ::sync_with_stdio(NULL), cin.tie(NULL), cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
