#include <bits/stdc++.h>
using namespace std;
const long long INF = 8e18;
inline long long cd(long long x) {
  if (~x & 1) return x / 2;
  return (x + 1) / 2;
}
inline long long fd(long long x) {
  if (~x & 1) return x / 2;
  return (x - 1) / 2;
}
long long l1, l2, l3, l4, r1, r2, r3, r4;
bool check(long long mid, long long &x, long long &y, long long &z) {
  long long lf, rg, a, b, c;
  for (long long r = 0; r <= 1; r++) {
    long long c1 = cd(l2 - mid - r), c2 = fd(r2 + mid - r),
              c3 = cd(l3 - mid - r), c4 = fd(r3 + mid - r),
              c5 = cd(l4 - mid - r), c6 = fd(r4 + mid - r);
    if (c1 > c2 || c3 > c4 || c5 > c6) continue;
    lf = max(c1 + c3 + c5, cd(l1 - mid - 3 * r));
    rg = min(c2 + c4 + c6, fd(r1 + mid - 3 * r));
    if (lf <= rg) {
      a = c1;
      b = c3;
      c = c5;
      if (lf - (a + b + c) > c2 - c1)
        a += c2 - c1;
      else
        a += lf - (a + b + c);
      if (lf - (a + b + c) > c4 - c3)
        b += c4 - c3;
      else
        b += lf - (a + b + c);
      if (lf - (a + b + c) > c6 - c5)
        c += c6 - c5;
      else
        c += lf - (a + b + c);
      x = b + c + r;
      y = a + c + r;
      z = a + b + r;
      return 1;
    }
  }
  return 0;
}
int main(int argc, const char *argv[]) {
  int T, n;
  long long x, y, z;
  scanf("%d", &T);
  while (T--) {
    l1 = l2 = l3 = l4 = -INF;
    r1 = r2 = r3 = r4 = INF;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%lld%lld%lld", &x, &y, &z);
      l1 = max(l1, x + y + z);
      r1 = min(r1, x + y + z);
      l2 = max(l2, -x + y + z);
      r2 = min(r2, -x + y + z);
      l3 = max(l3, x + z - y);
      r3 = min(r3, x + z - y);
      l4 = max(l4, x + y - z);
      r4 = min(r4, x + y - z);
    }
    long long mid, l = -1, r = 6e18 + 2;
    while (l < r - 1) {
      mid = (l + r) >> 1;
      if (check(mid, x, y, z))
        r = mid;
      else
        l = mid;
    }
    printf("%lld %lld %lld\n", x, y, z);
  }
  return 0;
}
