#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long INF = 4e18;
int T, n;
long long x[N], y[N], z[N];
long long resx, resy, resz;
bool getres(long long a, long long b, long long c, long long r);
void ceil(long long &x);
void floor(long long &x);
bool check(long long dist);
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
    long long l = 0, r = 3e18;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (check(mid))
        r = mid - 1;
      else
        l = mid + 1;
    }
    printf("%lld %lld %lld\n", resx, resy, resz);
  }
}
bool getres(long long a, long long b, long long c, long long r) {
  resx = a + b + r;
  resy = a + c + r;
  resz = b + c + r;
  return true;
}
void ceil(long long &x) {
  if (x < 0)
    x = x / 2;
  else
    x = (x + 1) / 2;
}
void floor(long long &x) {
  if (x > 0)
    x = x / 2;
  else
    x = (x - 1) / 2;
}
bool check(long long dist) {
  for (int r = 0; r < 2; r++) {
    long long amin = -INF, amax = INF;
    long long bmin = -INF, bmax = INF;
    long long cmin = -INF, cmax = INF;
    long long smin = -INF, smax = INF;
    for (int i = 1; i <= n; i++) {
      amin = max(amin, (x[i] + y[i] - z[i] - dist - r));
      bmin = max(bmin, (x[i] - y[i] + z[i] - dist - r));
      cmin = max(cmin, (-x[i] + y[i] + z[i] - dist - r));
      smin = max(smin, (x[i] + y[i] + z[i] - dist - 3 * r));
      amax = min(amax, (x[i] + y[i] - z[i] + dist - r));
      bmax = min(bmax, (x[i] - y[i] + z[i] + dist - r));
      cmax = min(cmax, (-x[i] + y[i] + z[i] + dist - r));
      smax = min(smax, (x[i] + y[i] + z[i] + dist - 3 * r));
    }
    ceil(amin), floor(amax);
    ceil(bmin), floor(bmax);
    ceil(cmin), floor(cmax);
    ceil(smin), floor(smax);
    if (amin > amax || bmin > bmax || cmin > cmax || smin > smax) continue;
    long long sum = amin + bmin + cmin;
    if (sum > smax) continue;
    if (sum - amin + amax >= smin)
      return getres(amin + max(0LL, smin - sum), bmin, cmin, r);
    sum += amax - amin;
    if (sum - bmin + bmax >= smin)
      return getres(amax, bmin + max(0LL, smin - sum), cmin, r);
    sum += bmax - bmin;
    if (sum - cmin + cmax >= smin)
      return getres(amax, bmax, cmin + max(0LL, smin - sum), r);
  }
  return false;
}
