#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
const long long INF = 1e18;
int cas, n;
long long L, R, X, Y, Z, tl[4], tr[4], a[4], s[3] = {1, -1}, li[10];
struct vec {
  long long x, y, z;
} p[N];
long long psu(long long x) { return (x + (x > 0)) / 2; }
long long psd(long long x) { return (x - (x < 0)) / 2; }
bool chk(long long A, bool fl) {
  for (int i = 0; i <= 7; i++) li[i] = 5 * INF;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 7; j++)
      li[j] = min(li[j], A + s[j & 1] * p[i].x + s[j >> 1 & 1] * p[i].y +
                             s[j >> 2] * p[i].z);
  for (int j = 0; j <= 7; j++)
    if (li[j] + li[j ^ 7] < 0) return 0;
  for (int i = 0; i <= 1; i++) {
    int ok = 1;
    long long U = 0, D = 0;
    for (int j = 0; j <= 2; j++) {
      tl[j] = psu(-li[1 << j ^ 7] - i);
      tr[j] = psd(+li[1 << j ^ 0] - i);
      if (tl[j] > tr[j]) {
        ok = 0;
        break;
      }
      D += tl[j], U += tr[j];
    }
    long long tu = psd(li[0] - 3 * i), td = psu(-li[7] - 3 * i);
    if (tu < td || U < td || tu < D) ok = 0;
    if (!ok) continue;
    if (fl) {
      for (int j = 0; j <= 2; j++) a[j] = tl[j];
      for (int j = 0; j <= 2; j++) {
        long long sum = a[0] + a[1] + a[2];
        if (sum < td) a[j] += min(tr[j] - tl[j], tu - sum);
      }
      X = a[1] + a[2] + i;
      Y = a[0] + a[2] + i;
      Z = a[0] + a[1] + i;
      long long tmp = 0;
      for (int j = 1; j <= n; j++)
        tmp = max(tmp, ((X - p[j].x) < 0 ? -(X - p[j].x) : (X - p[j].x)) +
                           ((Y - p[j].y) < 0 ? -(Y - p[j].y) : (Y - p[j].y)) +
                           ((Z - p[j].z) < 0 ? -(Z - p[j].z) : (Z - p[j].z)));
      assert(tmp == L);
    }
    return 1;
  }
  return 0;
}
void work() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld%lld%lld", &p[i].x, &p[i].y, &p[i].z);
  L = 0;
  R = 3 * INF;
  while (L < R) {
    long long md = (L + R) >> 1;
    chk(md, 0) ? R = md : L = md + 1;
  }
  chk(L, 1);
  cout << X << ' ' << Y << ' ' << Z << '\n';
}
int main() {
  scanf("%d", &cas);
  while (cas--) work();
}
