#include <bits/stdc++.h>
using namespace std;
inline void cmax(long long &x, const long long &y) {
  if (x < y) x = y;
}
inline void cmin(long long &x, const long long &y) {
  if (y < x) x = y;
}
int n;
long long mx[4], mi[4], resx, resy, resz;
inline bool check(long long d) {
  long long l[4], r[4];
  for (int p = 0; p <= 1; ++p) {
    l[0] = (mi[0] - d - 3 * p + 1) >> 1;
    r[0] = (mx[0] + d - 3 * p) >> 1;
    for (int i = 1; i < 4; ++i) {
      l[i] = (mi[i] - d - p + 1) >> 1;
      r[i] = (mx[i] + d - p) >> 1;
    }
    long long a = l[1], b = l[2], c = l[3];
    if (a + b + c > r[0] || l[0] > r[0] || l[1] > r[1] || l[2] > r[2] ||
        l[3] > r[3])
      continue;
    long long tmp = max(l[0] - a - b - c, 0ll), now;
    now = min(tmp, r[1] - a), tmp -= now, a += now;
    now = min(tmp, r[2] - b), tmp -= now, b += now;
    now = min(tmp, r[3] - c), tmp -= now, c += now;
    if (tmp) continue;
    a = a * 2 + p;
    b = b * 2 + p;
    c = c * 2 + p;
    resx = (b + c) >> 1;
    resy = (a + c) >> 1;
    resz = (a + b) >> 1;
    return 1;
  }
  return 0;
}
void work() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    long long x, y, z;
    scanf("%lld%lld%lld", &x, &y, &z);
    if (i == 1) {
      mx[0] = mi[0] = +x + y + z;
      mx[1] = mi[1] = -x + y + z;
      mx[2] = mi[2] = +x - y + z;
      mx[3] = mi[3] = +x + y - z;
    } else {
      cmin(mx[0], +x + y + z);
      cmax(mi[0], +x + y + z);
      cmin(mx[1], -x + y + z);
      cmax(mi[1], -x + y + z);
      cmin(mx[2], +x - y + z);
      cmax(mi[2], +x - y + z);
      cmin(mx[3], +x + y - z);
      cmax(mi[3], +x + y - z);
    }
  }
  long long l = 0, r = 3e18, res = r;
  while (l <= r) {
    long long mid = (l + r) >> 1;
    if (check(mid))
      r = (res = mid) - 1;
    else
      l = mid + 1;
  }
  check(res);
  printf("%lld %lld %lld\n", resx, resy, resz);
}
int main() {
  int T;
  cin >> T;
  while (T--) work();
  return 0;
}
