#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)1e5 + 10;
const int INF = (int)1e9 + 5;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)4e18 + 5;
int n;
long long x[maxN];
long long y[maxN];
long long z[maxN];
long long xx, yy, zz;
struct interval {
  long long l, r;
  interval() : l(-LLINF), r(LLINF) {}
  interval(long long l, long long r) : l(l), r(r) {}
  friend interval inter(const interval &a, const interval &b) {
    return interval(max(a.l, b.l), min(a.r, b.r));
  }
  bool bad() const { return l > r; }
  bool in(long long x) const { return l <= x && x <= r; }
};
bool bad(interval a, interval b, interval c, interval d) {
  return a.bad() || b.bad() || c.bad() || d.bad() || a.l + b.l + c.l > d.r ||
         a.r + b.r + c.r < d.l;
}
void potihonku_uvelichivaem(long long &a, long long &mx, long long lim) {
  long long v = min(mx, lim);
  mx -= v;
  a += v;
}
long long a, b, c;
bool can(long long R) {
  interval A, B, C, D;
  for (int i = 0; i < n; ++i) {
    if (i == 0) {
      D = interval(x[i] + y[i] + z[i] - R, x[i] + y[i] + z[i] + R);
      A = interval(-x[i] + y[i] + z[i] - R, -x[i] + y[i] + z[i] + R);
      B = interval(x[i] - y[i] + z[i] - R, x[i] - y[i] + z[i] + R);
      C = interval(x[i] + y[i] - z[i] - R, x[i] + y[i] - z[i] + R);
      continue;
    }
    D = inter(D, interval(x[i] + y[i] + z[i] - R, x[i] + y[i] + z[i] + R));
    A = inter(A, interval(-x[i] + y[i] + z[i] - R, -x[i] + y[i] + z[i] + R));
    B = inter(B, interval(x[i] - y[i] + z[i] - R, x[i] - y[i] + z[i] + R));
    C = inter(C, interval(x[i] + y[i] - z[i] - R, x[i] + y[i] - z[i] + R));
  }
  if (bad(A, B, C, D)) return false;
  a = A.l;
  b = B.l;
  c = C.l;
  long long add = max(0LL, D.l - a - b - c);
  potihonku_uvelichivaem(a, add, A.r - A.l);
  potihonku_uvelichivaem(b, add, B.r - B.l);
  potihonku_uvelichivaem(c, add, C.r - C.l);
  assert(add == 0);
  assert(A.in(a));
  assert(B.in(b));
  assert(C.in(c));
  assert(D.in(a + b + c));
  for (long long aa = a - 2; aa <= a + 2; ++aa) {
    for (long long bb = b - 2; bb <= b + 2; ++bb) {
      for (long long cc = c - 2; cc <= c + 2; ++cc) {
        if (abs(aa % 2) != abs(bb % 2) || abs(aa % 2) != abs(cc % 2)) continue;
        if (A.in(aa) && B.in(bb) && C.in(cc) && D.in(aa + bb + cc)) {
          xx = (bb + cc) / 2;
          yy = (aa + cc) / 2;
          zz = (aa + bb) / 2;
          return true;
        }
      }
    }
  }
  return false;
}
void solve() {
  n = nextInt<int>();
  for (int i = 0; i < n; ++i) {
    x[i] = nextInt<long long>();
    y[i] = nextInt<long long>();
    z[i] = nextInt<long long>();
  }
  long long l = 0, r = LLINF;
  for (int iter = 0; iter < 65; ++iter) {
    long long m = (l + r) / 2;
    if (can(m)) {
      r = m;
    } else {
      l = m;
    }
  }
  can(r);
  printf("%I64d %I64d %I64d\n", xx, yy, zz);
}
int main() {
  int t = nextInt<int>();
  while (t--) {
    solve();
  }
  return 0;
}
