#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const long long INF = (1ll << 63) - 1;
struct node {
  long long x, y, z;
} po[maxn];
int n;
void update(pair<long long, long long> &ra, long long mid, long long lim,
            long long ad) {
  long long r = (lim + mid - ad), l = (mid - ad - lim);
  r = r / 2 - (r < 0) * (abs(r) % 2);
  l = l / 2 + (l >= 0) * (abs(l) % 2);
  ra.first = max(ra.first, l), ra.second = min(ra.second, r);
}
bool illegal(pair<long long, long long> r) { return r.first > r.second; }
bool test(long long lim, long long &x, long long &y, long long &z) {
  for (int r = 0; r < 2; r++) {
    pair<long long, long long> ar{-INF, INF}, br{-INF, INF}, cr{-INF, INF},
        dr{-INF, INF};
    for (int i = 1; i <= n; i++) {
      long long a = -po[i].x + po[i].y + po[i].z,
                b = po[i].x - po[i].y + po[i].z,
                c = po[i].x + po[i].y - po[i].z;
      update(ar, a, lim, r);
      update(br, b, lim, r);
      update(cr, c, lim, r);
      update(dr, a + b + c, lim, 3 * r);
    }
    if (illegal(ar) || illegal(br) || illegal(cr) || illegal(dr)) continue;
    pair<long long, long long> bak_b = br, bak_c = cr;
    cr = pair<long long, long long>(dr.first - cr.second, dr.second - cr.first);
    br = pair<long long, long long>(cr.first - br.second, cr.second - br.first);
    if (illegal(pair<long long, long long>(max(ar.first, br.first),
                                           min(ar.second, br.second))))
      continue;
    long long a = max(ar.first, br.first), b = max(cr.first - a, bak_b.first),
              c = max(dr.first - a - b, bak_c.first);
    a = a * 2 + r, b = b * 2 + r, c = c * 2 + r;
    z = (a + b) / 2, x = (b + c) / 2, y = (a + c) / 2;
    return 1;
  }
  return 0;
}
void work() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%lld%lld%lld", &po[i].x, &po[i].y, &po[i].z);
  long long l = 0, r = (1ll << 62), tmp = -1, bx, by, bz;
  for (long long mid; l <= r;) {
    mid = l + r >> 1;
    if (test(mid, bx, by, bz))
      tmp = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  test(tmp, bx, by, bz);
  printf("%lld %lld %lld\n", bx, by, bz);
}
int main() {
  int t;
  scanf("%d", &t);
  for (; t; t--) work();
  return 0;
}
