#include <bits/stdc++.h>
using namespace std;
struct TPoint {
  long long x, y, z;
};
const int Nmax = 1e5 + 7;
const long long INF = LLONG_MAX;
int t, n;
TPoint rose[Nmax];
TPoint make_point(const long long &X, const long long &Y, const long long &Z) {
  TPoint res;
  res.x = X;
  res.y = Y;
  res.z = Z;
  return res;
}
TPoint abc(const long long &a, const long long &b, const long long &c) {
  if (a & 1)
    return make_point((b - 1) / 2 + (c - 1) / 2 + 1,
                      (c - 1) / 2 + (a - 1) / 2 + 1,
                      (a - 1) / 2 + (b - 1) / 2 + 1);
  return make_point(b / 2 + c / 2, c / 2 + a / 2, a / 2 + b / 2);
}
TPoint get_sol(const long long *limit, const bool &r) {
  long long lim[8];
  for (int i = 0; i < 8; ++i) lim[i] = limit[i];
  for (int i = 0; i < 8; ++i) {
    if (i < 4 && ((lim[i] & 1) != r)) ++lim[i];
    if (i >= 4 && ((lim[i] & 1) != r)) --lim[i];
  }
  if (lim[0] > lim[4]) return make_point(INF, INF, INF);
  if (lim[1] > lim[5]) return make_point(INF, INF, INF);
  if (lim[2] > lim[6]) return make_point(INF, INF, INF);
  if (lim[3] > lim[7]) return make_point(INF, INF, INF);
  long long a, b, c;
  a = lim[0];
  b = lim[1];
  c = lim[2];
  if (a + b + c > lim[7]) return make_point(INF, INF, INF);
  if (a + b + c >= lim[3]) return abc(a, b, c);
  if (lim[4] + b + c >= lim[3]) return abc(lim[3] - b - c, b, c);
  a = lim[4];
  if (a + lim[5] + c >= lim[3]) return abc(a, lim[3] - a - c, c);
  b = lim[5];
  if (a + b + lim[6] >= lim[3]) return abc(a, b, lim[3] - a - b);
  return make_point(INF, INF, INF);
}
TPoint f(const long long &m) {
  long long lim[8], a, b, c;
  lim[0] = lim[1] = lim[2] = lim[3] = -INF;
  lim[4] = lim[5] = lim[6] = lim[7] = INF;
  for (int i = 0; i < n; ++i) {
    lim[0] = max(lim[0], -rose[i].x + rose[i].y + rose[i].z - m);
    lim[1] = max(lim[1], rose[i].x - rose[i].y + rose[i].z - m);
    lim[2] = max(lim[2], rose[i].x + rose[i].y - rose[i].z - m);
    lim[3] = max(lim[3], rose[i].x + rose[i].y + rose[i].z - m);
    lim[4] = min(lim[4], -rose[i].x + rose[i].y + rose[i].z + m);
    lim[5] = min(lim[5], rose[i].x - rose[i].y + rose[i].z + m);
    lim[6] = min(lim[6], rose[i].x + rose[i].y - rose[i].z + m);
    lim[7] = min(lim[7], rose[i].x + rose[i].y + rose[i].z + m);
  }
  if (lim[0] > lim[4] || lim[1] > lim[5] || lim[2] > lim[6] || lim[3] > lim[7])
    return make_point(INF, INF, INF);
  if (lim[0] + lim[1] + lim[2] > lim[7] || lim[4] + lim[5] + lim[6] < lim[3])
    return make_point(INF, INF, INF);
  TPoint P = get_sol(lim, 0);
  if (P.x < INF) return P;
  return get_sol(lim, 1);
}
int main() {
  long long L, R, mid;
  TPoint P;
  scanf("%d", &t);
  for (int test = 0; test < t; ++test) {
    scanf("%d", &n);
    for (int i = 0; i < n; ++i) {
      long long X, Y, Z;
      scanf("%I64d %I64d %I64d", &X, &Y, &Z);
      rose[i] = make_point(X, Y, Z);
    }
    L = -1;
    R = (long long)3e18 + 10;
    while (R - L > 1) {
      mid = L + (R - L) / 2;
      P = f(mid);
      if (P.x < INF)
        R = mid;
      else
        L = mid;
    }
    P = f(R);
    printf("%I64d %I64d %I64d\n", P.x, P.y, P.z);
  }
  return 0;
}
