#include <bits/stdc++.h>
using namespace std;
const long long inf = (long long)3.0e18;
long long a, b, c, d, e, f, g, h;
long long sx, sy, sz;
long long absq(long long a) {
  if (a > 0)
    return a;
  else
    return -a;
}
bool check(long long mid) {
  long long d0, u0, d1, u1;
  d0 = a - d - 2 * mid;
  u0 = b - c + 2 * mid;
  d1 = g - f - 2 * mid;
  u1 = h - e + 2 * mid;
  if (d0 & 1) d0++;
  if (u0 & 1) u0--;
  if (d1 & 1) d1++;
  if (u1 & 1) u1--;
  d0 >>= 1;
  u0 >>= 1;
  d1 >>= 1;
  u1 >>= 1;
  if (d0 > u1 || d1 > u0) return 0;
  d0 = max(d0, d1);
  u0 = min(u0, u1);
  for (long long i = d0; i <= min(u0, d0 + 1); i++) {
    long long p0, q0, p1, q1;
    p0 = max(a - mid - i, c - mid + i);
    q0 = min(b - i + mid, d + i + mid);
    p1 = max(g - mid - i, e - mid + i);
    q1 = min(h - i + mid, mid + f + i);
    if (p0 > q0 || p1 > q1) continue;
    for (long long sum = p0; sum <= min(q0, p0 + 1); sum++) {
      for (long long sub = p1; sub <= min(q1, p1 + 1); sub++) {
        if (~(sum - sub) & 1) {
          sx = i;
          sy = (sum + sub) / 2;
          sz = (sum - sub) / 2;
          return 1;
        }
      }
    }
  }
  return 0;
}
int main() {
  int n, i, j, T;
  long long x, y, z, r;
  cin >> T;
  while (T--) {
    scanf("%d", &n);
    a = c = e = g = r = -inf;
    b = d = f = h = inf;
    for (i = 1; i <= n; i++) {
      scanf("%I64d %I64d %I64d", &x, &y, &z);
      a = max(a, x + y + z);
      b = min(b, x + y + z);
      c = max(c, -x + y + z);
      d = min(d, -x + y + z);
      e = max(e, -x + y - z);
      f = min(f, -x + y - z);
      g = max(g, x + y - z);
      h = min(h, x + y - z);
      r = max(r, abs(x) + abs(y) + abs(z));
    }
    long long l = 0, mid;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (check(mid)) {
        r = mid - 1;
      } else
        l = mid + 1;
    }
    check(r);
    printf("%I64d %I64d %I64d\n", sx, sy, sz);
  }
}
