#include <bits/stdc++.h>
using namespace std;
int T, n;
long long a, b, c, lim[5][3];
bool flag;
struct Point {
  long long x;
  long long y;
  long long z;
} OP, P;
long long dist(Point P) {
  return max(max(max(abs(P.x + P.y + P.z - lim[0][0]),
                     abs(P.x + P.y + P.z - lim[0][1])),
                 max(abs(-P.x + P.y + P.z - lim[1][0]),
                     abs(-P.x + P.y + P.z - lim[1][1]))),
             max(max(abs(P.x - P.y + P.z - lim[2][0]),
                     abs(P.x - P.y + P.z - lim[2][1])),
                 max(abs(P.x + P.y - P.z - lim[3][0]),
                     abs(P.x + P.y - P.z - lim[3][1]))));
}
pair<bool, long long> findmin(long long le, long long ri, int i) {
  if (le > ri) return make_pair(0, 0);
  if (le == ri) {
    if ((le - i) % 2 == 0)
      return make_pair(1, le);
    else
      return make_pair(0, 0);
  }
  if ((le - i) % 2 == 0)
    return make_pair(1, le);
  else
    return make_pair(1, le + 1);
}
pair<bool, long long> findmax(long long le, long long ri, int i) {
  if (le > ri) return make_pair(0, 0);
  if (le == ri) {
    if ((le - i) % 2 == 0)
      return make_pair(1, le);
    else
      return make_pair(0, 0);
  }
  if ((ri - i) % 2 == 0)
    return make_pair(1, ri);
  else
    return make_pair(1, ri - 1);
}
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(lim[i][1] - l - ddd + 1);
      c[i] = integer(lim[i][0] - 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];
          }
        }
        OP.x = a[2] + a[3] + l;
        OP.y = a[1] + a[3] + l;
        OP.z = a[1] + a[2] + l;
      } else {
        OP.x = b[2] + b[3] + l;
        OP.y = b[1] + b[3] + l;
        OP.z = b[1] + b[2] + l;
      }
      return true;
    }
  }
  return false;
}
long long calc(long long le, long long ri) {
  if (le == ri) return le;
  long long mid = le + (ri - le) / 2;
  if (!test(mid))
    return calc(mid + 1, ri);
  else
    return calc(le, mid);
}
int main() {
  scanf("%d", &T);
  while (T--) {
    for (int i = 0; i < 4; i++) {
      lim[i][0] = ((1LL << 62) - 1 << 1) + 1;
      lim[i][1] = -((1LL << 62) - 1 << 1) + 1;
    }
    scanf("%d", &n);
    while (n--) {
      scanf("%I64d %I64d %I64d", &a, &b, &c);
      if (lim[0][0] > a + b + c) lim[0][0] = a + b + c;
      if (lim[0][1] < a + b + c) lim[0][1] = a + b + c;
      if (lim[1][0] > -a + b + c) lim[1][0] = -a + b + c;
      if (lim[1][1] < -a + b + c) lim[1][1] = -a + b + c;
      if (lim[2][0] > a - b + c) lim[2][0] = a - b + c;
      if (lim[2][1] < a - b + c) lim[2][1] = a - b + c;
      if (lim[3][0] > a + b - c) lim[3][0] = a + b - c;
      if (lim[3][1] < a + b - c) lim[3][1] = a + b - c;
    }
    test(calc(0, 3000000000000000005));
    printf("%I64d %I64d %I64d\n", OP.x, OP.y, OP.z);
  }
}
