#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long Inf = 1e10;
const int N = 100005;
template <typename T>
inline T IN() {
  T x;
  int ch, f;
  for (ch = getchar(); ch != -1 && (ch < 48 || ch > 57); ch = getchar())
    f = (ch == '-');
  for (; ch >= 48 && ch <= 57; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return f ? (-x) : x;
}
template <typename T>
inline int chkmin(T &a, const T &b) {
  if (b < a) return a = b, 1;
  return 0;
}
template <typename T>
inline int chkmax(T &a, const T &b) {
  if (b > a) return a = b, 1;
  return 0;
}
int Pow(int x, int y, int p) {
  int a = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) a = (long long)a * x % p;
  return a;
}
long long Ceil(long long val);
long long Floor(long long val);
long long Ceil(long long val) {
  if (val == 0) return 0;
  if (val < 0) return -Floor(-val);
  return (val + 1) / 2;
}
long long Floor(long long val) {
  if (val == 0) return 0;
  if (val < 0) return -Ceil(-val);
  return val / 2;
}
int n, T;
long long Mn[10], Ma[10], F[10], L[10], R[10], FL[10], FR[10], DR, DL, P[10];
void chk(long long sum, long long P0, long long P1, int oht, int e,
         long long *V1, long long *V2, long long *V3) {
  long long Vr = sum - P0 - P1;
  if (FL[oht] <= Vr && Vr <= FR[oht]) {
    *V1 = sum - P0 + e;
    *V2 = sum - P1 + e;
    *V3 = sum - Vr + e;
  }
}
int check(long long key) {
  for (int d = (int)(0); d < (int)(4); d++) {
    L[d] = Ma[d] - key;
    R[d] = Mn[d] + key;
  }
  for (int e = (int)(0); e < (int)(2); e++) {
    bool ok = 1;
    for (int d = (int)(0); d < (int)(4); d++) {
      FL[d] = L[d] - e * (d == 0 ? 3 : 1);
      FR[d] = R[d] - e * (d == 0 ? 3 : 1);
      FR[d] = Floor(FR[d]);
      FL[d] = Ceil(FL[d]);
    }
    for (int d = (int)(0); d < (int)(4); d++)
      if (FL[d] > FR[d]) ok = 0;
    DR = DL = 0;
    for (int d = (int)(1); d < (int)(4); d++) DR += FR[d], DL += FL[d];
    if (FL[0] > DR || DL > FR[0]) ok = 0;
    if (ok) {
      P[0] = P[1] = P[2] = 1e18;
      long long val = max(FL[0], DL);
      chk(val, FL[1], FL[2], 3, e, P, P + 1, P + 2);
      chk(val, FL[1], FR[2], 3, e, P, P + 1, P + 2);
      chk(val, FL[1], FL[3], 2, e, P, P + 2, P + 1);
      chk(val, FL[1], FR[3], 2, e, P, P + 2, P + 1);
      chk(val, FL[2], FL[3], 1, e, P + 1, P + 2, P);
      chk(val, FL[2], FR[3], 1, e, P + 1, P + 2, P);
      chk(val, FR[1], FL[2], 3, e, P, P + 1, P + 2);
      chk(val, FR[1], FR[2], 3, e, P, P + 1, P + 2);
      chk(val, FR[1], FL[3], 2, e, P, P + 2, P + 1);
      chk(val, FR[1], FR[3], 2, e, P, P + 2, P + 1);
      chk(val, FR[2], FL[3], 1, e, P + 1, P + 2, P);
      chk(val, FR[2], FR[3], 1, e, P + 1, P + 2, P);
      return 1;
    }
  }
  return 0;
}
void Main() {
  scanf("%d", &n);
  memset(Mn, 0x3f, sizeof Mn);
  memset(Ma, -0x3f, sizeof Ma);
  for (int i = (int)(1); i <= (int)(n); i++) {
    long long x, y, z;
    scanf("%lld%lld%lld", &x, &y, &z);
    F[0] = 0 + x + y + z;
    F[1] = 0 - x + y + z;
    F[2] = 0 + x - y + z;
    F[3] = 0 + x + y - z;
    for (int d = (int)(0); d < (int)(4); d++) {
      Mn[d] = min(Mn[d], F[d]);
      Ma[d] = max(Ma[d], F[d]);
    }
  }
  long long l = 0, r = 3.1e18, aim = r;
  while (l <= r) {
    long long md = (l + r) / 2;
    if (check(md)) {
      aim = md;
      r = md - 1;
    } else {
      l = md + 1;
    }
  }
  check(0);
  check(aim);
  printf("%lld %lld %lld\n", P[0], P[1], P[2]);
}
int main() {
  scanf("%d", &T);
  while (T--) Main();
  return 0;
}
