#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3fffffff;
const long long oo = 3000000000000000000LL;
int tes, n;
long long ans[3], mn[4], mx[4], ll[4], rr[4], lt[4], rt[4], ret[3];
bool get(long long s, long long x, long long y, long long z) {
  if (s <= x) {
    ret[0] = s;
    ret[1] = 0;
    ret[2] = 0;
    return 1;
  } else if (s <= x + y) {
    ret[0] = x;
    ret[1] = s - x;
    ret[2] = 0;
    return 1;
  } else if (s <= x + y + z) {
    ret[0] = x;
    ret[1] = y;
    ret[2] = s - x - y;
    return 1;
  }
  return 0;
}
long long shr1(long long x) { return (x - (x & 1)) / 2; }
bool jd(long long t) {
  int i, j;
  long long s, x, y, z;
  for (i = 0; i <= 3; i++) {
    if (mn[i] + t < mx[i] - t) return 0;
    ll[i] = mx[i] - t;
    rr[i] = mn[i] + t;
  }
  for (i = 0; i < 2; i++) {
    lt[0] = shr1(ll[0] - 3 * i + 1);
    rt[0] = shr1(rr[0] - 3 * i);
    for (j = 1; j <= 3; j++) {
      lt[j] = shr1(ll[j] - i + 1);
      rt[j] = shr1(rr[j] - i);
    }
    if (lt[0] <= rt[0] && lt[1] <= rt[1] && lt[2] <= rt[2] && lt[3] <= rt[3] &&
        lt[1] + lt[2] + lt[3] <= rt[0]) {
      if (lt[1] + lt[2] + lt[3] >= lt[0]) {
        ret[0] = lt[1];
        ret[1] = lt[2];
        ret[2] = lt[3];
        ans[0] = ret[1] + ret[2] + i;
        ans[1] = ret[0] + ret[2] + i;
        ans[2] = ret[0] + ret[1] + i;
        return 1;
      }
      if (get(lt[0] - lt[1] - lt[2] - lt[3], rt[1] - lt[1], rt[2] - lt[2],
              rt[3] - lt[3])) {
        ret[0] += lt[1];
        ret[1] += lt[2];
        ret[2] += lt[3];
        ans[0] = ret[1] + ret[2] + i;
        ans[1] = ret[0] + ret[2] + i;
        ans[2] = ret[0] + ret[1] + i;
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  long long x, y, z, s, l, r, mid;
  int i;
  scanf("%d", &tes);
  while (tes--) {
    scanf("%d", &n);
    for (i = 0; i <= 3; i++) {
      mx[i] = -oo;
      mn[i] = oo;
    }
    for (i = 1; i <= n; i++) {
      scanf("%I64d%I64d%I64d", &x, &y, &z);
      s = x + y + z;
      mx[0] = max(mx[0], s);
      mn[0] = min(mn[0], s);
      mx[1] = max(mx[1], s - x - x);
      mn[1] = min(mn[1], s - x - x);
      mx[2] = max(mx[2], s - y - y);
      mn[2] = min(mn[2], s - y - y);
      mx[3] = max(mx[3], s - z - z);
      mn[3] = min(mn[3], s - z - z);
    }
    l = 0;
    r = oo;
    while (l < r) {
      mid = (l + r) >> 1;
      if (jd(mid))
        r = mid;
      else
        l = mid + 1;
    }
    jd(l);
    printf("%I64d %I64d %I64d\n", ans[0], ans[1], ans[2]);
  }
}
