#include <bits/stdc++.h>
using namespace std;
template <typename tp>
inline void read(tp& x) {
  x = 0;
  char tmp;
  bool key = 0;
  for (tmp = getchar(); !isdigit(tmp); tmp = getchar()) key = (tmp == '-');
  for (; isdigit(tmp); tmp = getchar()) x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}
template <typename tp>
inline void ckmn(tp& x, tp y) {
  x = x < y ? x : y;
}
template <typename tp>
inline void ckmx(tp& x, tp y) {
  x = x < y ? y : x;
}
const int N = 100010;
const long long LLINF = 6 * (long long)1e18;
int n;
long long vx[N], vy[N], vz[N];
long long Ceil2(long long x) {
  if (x >= 0)
    return ((x + 1) >> 1);
  else
    return x / 2;
}
long long Floor2(long long x) {
  if (x >= 0)
    return x >> 1;
  else
    return (x - 1) / 2;
}
bool check(long long d, long long& x, long long& y, long long& z) {
  long long l0, r0, l1, r1, l2, r2, l3, r3;
  l0 = l1 = l2 = l3 = -LLINF;
  r0 = r1 = r2 = r3 = LLINF;
  for (int i = (1); i <= (n); ++i) {
    ckmx(l0, vx[i] + vy[i] + vz[i] - d);
    ckmn(r0, vx[i] + vy[i] + vz[i] + d);
    ckmx(l1, -vx[i] + vy[i] + vz[i] - d);
    ckmn(r1, -vx[i] + vy[i] + vz[i] + d);
    ckmx(l2, vx[i] - vy[i] + vz[i] - d);
    ckmn(r2, vx[i] - vy[i] + vz[i] + d);
    ckmx(l3, vx[i] + vy[i] - vz[i] - d);
    ckmn(r3, vx[i] + vy[i] - vz[i] + d);
  }
  if ((l0 > r0) || (l1 > r1) || (l2 > r2) || (l3 > r3)) return false;
  for (int r = (0); r <= (1); ++r) {
    long long tl0 = Ceil2(l0 - 3 * r);
    long long tr0 = Floor2(r0 - 3 * r);
    long long tl1 = Ceil2(l1 - r);
    long long tr1 = Floor2(r1 - r);
    long long tl2 = Ceil2(l2 - r);
    long long tr2 = Floor2(r2 - r);
    long long tl3 = Ceil2(l3 - r);
    long long tr3 = Floor2(r3 - r);
    if (tl0 > tr0 || tl1 > tr1 || tl2 > tr2 || tl3 > tr3) continue;
    if (tl1 + tl2 + tl3 <= tr0 && tr1 + tr2 + tr3 >= tl0) {
      long long a, b, c;
      if (tl0 > tl1 + tl2 + tl3) {
        tl0 -= tl1 + tl2 + tl3;
        long long v = max(0ll, min(tl0, tr1 - tl1));
        a = tl1 + v;
        tl0 -= v;
        v = max(0ll, min(tl0, tr2 - tl2));
        b = tl2 + v;
        tl0 -= v;
        v = max(0ll, min(tl0, tr3 - tl3));
        c = tl3 + v;
        tl0 -= v;
      } else {
        a = tl1, b = tl2, c = tl3;
      }
      a = 2 * a + r, b = 2 * b + r, c = 2 * c + r;
      x = (b + c) / 2, y = (a + c) / 2, z = (a + b) / 2;
      assert(l0 <= a + b + c && a + b + c <= r0);
      assert(l1 <= a && a <= r1);
      assert(l2 <= b && b <= r2);
      assert(l3 <= c && c <= r3);
      return true;
    }
  }
  return false;
}
void solve() {
  read(n);
  for (int i = (1); i <= (n); ++i) {
    read(vx[i]), read(vy[i]), read(vz[i]);
  }
  long long x, y, z;
  long long l = 0, r = 3 * (long long)1e18;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid, x, y, z))
      r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld %lld %lld\n", x, y, z);
}
int main() {
  int T;
  read(T);
  while (T--) solve();
  return 0;
}
