#include <bits/stdc++.h>
using namespace std;
int n, runs;
long long x[10], t[10], mx[10], mn[10], res, p, q, r, st, en;
long long integer(long long xx, long long yy = 2) {
  if (xx >= 0)
    return (xx / yy);
  else {
    if (xx % yy == 0)
      return (xx / yy);
    else
      return (xx / yy - 1);
  }
}
long long ma(long long r, long long s) {
  if (r < 0) r = 0 - r;
  if (s < 0) s = 0 - s;
  if (r < s)
    return s;
  else
    return r;
}
bool test(long long ddd) {
  bool flag, zz;
  long long a[6], b[6], c[6], sum, sss;
  for (long long l = 0; l < 2; l++) {
    zz = 0;
    for (int i = 0; i < 4; i++) {
      b[i] = integer(mx[i] - l - ddd + 1);
      c[i] = integer(mn[i] - l + ddd);
      if (b[i] > c[i]) zz = 1;
    }
    b[0] -= l;
    c[0] -= l;
    if (zz) continue;
    flag = 0;
    if (b[1] + b[2] + b[3] > c[0]) flag = 1;
    if (c[1] + c[2] + c[3] < b[0]) flag = 1;
    if (!flag) {
      if (b[1] + b[2] + b[3] <= b[0]) {
        sum = b[0];
        sss = 0;
        for (int i = 1; i <= 3; i++) {
          a[i] = b[i];
          sss += a[i];
        }
        for (int i = 1; i <= 3; i++) {
          if (sss - a[i] + c[i] >= sum) {
            a[i] += sum - sss;
            break;
          } else {
            sss = sss - a[i] + c[i];
            a[i] = c[i];
          }
        }
        p = a[2] + a[3] + l;
        q = a[1] + a[3] + l;
        r = a[1] + a[2] + l;
      } else {
        p = b[2] + b[3] + l;
        q = b[1] + b[3] + l;
        r = b[1] + b[2] + l;
      }
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%d", &runs);
  while (runs--) {
    scanf("%d", &n);
    res = 0;
    for (int i = 0; i < n; i++) {
      scanf("%I64d%I64d%I64d", &x[0], &x[1], &x[2]);
      t[0] = x[0] + x[1] + x[2];
      t[1] = x[1] + x[2] - x[0];
      t[2] = x[0] - x[1] + x[2];
      t[3] = x[0] + x[1] - x[2];
      for (int j = 0; j < 4; j++) {
        if (!i) {
          mx[j] = t[j];
          mn[j] = t[j];
        }
        if (mx[j] < t[j]) mx[j] = t[j];
        if (mn[j] > t[j]) mn[j] = t[j];
      }
    }
    for (int j = 0; j < 4; j++)
      if (res < (mx[j] - mn[j] + 1) / 2) res = (mx[j] - mn[j] + 1) / 2;
    if (res < integer(mx[1], 4) + integer(mx[2], 4) + integer(mx[3], 4) -
                  integer(mn[0] + 3LL, 4))
      res = integer(mx[1] + mx[2] + mx[3] - mn[0], 4);
    if (res < integer(mx[0], 4) - integer(mn[1] + 3LL, 4) -
                  integer(mn[2] + 3LL, 4) - integer(mn[3] + 3LL, 4))
      res = integer(mx[0] - mn[1] - mn[2] - mn[3], 4);
    st = res;
    en = 0;
    for (int i = 0; i < 4; i++)
      if (en < ma(mx[i], mn[i])) en = ma(mx[i], mn[i]);
    if (test(st))
      en = st;
    else {
      int mm = 100;
      while (mm--) {
        res = (st + en + 1LL) / 2;
        if (test(res))
          en = res;
        else
          st = res;
      }
    }
    printf("%I64d %I64d %I64d\n", p, q, r);
  }
}
