#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const long long MAX = 8e18;
const long long MIN = -8e18;
int n;
long long x[N];
long long y[N];
long long z[N];
vector<long long> ansX;
vector<long long> ansY;
vector<long long> ansZ;
inline long long llabs(const long long &a, const long long &b) {
  long long res = a - b;
  return (res >= 0 ? res : -res);
}
inline long long calDist(long long z0, pair<long long, long long> &xy) {
  long long minA, maxA, minB, maxB, h, dist2, a, b;
  int i, j, k;
  minA = minB = MAX;
  maxA = maxB = MIN;
  for (i = 0; i < n; i++) {
    h = llabs(z0, z[i]);
    minA = min(minA, x[i] + y[i] - h);
    maxA = max(maxA, x[i] + y[i] + h);
    minB = min(minB, x[i] - y[i] - h);
    maxB = max(maxB, x[i] - y[i] + h);
  }
  dist2 = max(maxA - minA, maxB - minB);
  a = (maxA + minA) / 2;
  b = (maxB + minB) / 2;
  xy.first = (a + b) / 2;
  xy.second = (a - b) / 2;
  return dist2;
}
inline void solve() {
  int i;
  long long left = -1e18;
  long long right = 1e18;
  long long mid1, mid2;
  pair<long long, long long> xy;
  while (right - left > 4) {
    mid1 = (left + left + right) / 3;
    mid2 = (left + right + right) / 3;
    if (calDist(mid1, xy) < calDist(mid2, xy)) {
      right = mid2;
    } else {
      left = mid1;
    }
  }
  long long bestZ, bestY, bestX, bestDist, curDist, curY, curX, initX, initY,
      curZ;
  bestDist = MAX;
  for (curZ = left; curZ <= right; curZ++) {
    curDist = calDist(curZ, xy);
    if (curDist < bestDist) {
      bestDist = curDist;
      bestZ = curZ;
      initX = xy.first;
      initY = xy.second;
    }
  }
  bestDist = MAX;
  for (curX = initX - 1; curX <= initX + 1; curX++) {
    for (curY = initY - 1; curY <= initY + 1; curY++) {
      curDist = 0;
      for (i = 0; i < n; i++) {
        curDist = max(curDist, llabs(x[i] - curX) + llabs(y[i] - curY) +
                                   llabs(bestZ - z[i]));
      }
      if (curDist < bestDist) {
        bestDist = curDist;
        bestX = curX;
        bestY = curY;
      }
    }
  }
  ansX.push_back(bestX);
  ansY.push_back(bestY);
  ansZ.push_back(bestZ);
}
int main() {
  int t, i, k;
  scanf("%d", &t);
  for (k = 0; k < t; k++) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf(
          "%l"
          "ld"
          "%l"
          "ld"
          "%l"
          "ld",
          &x[i], &y[i], &z[i]);
    }
    solve();
  }
  for (i = 0; i < t; i++) {
    printf(
        "%l"
        "ld"
        " "
        "%l"
        "ld"
        " "
        "%l"
        "ld"
        "\n",
        ansX[i], ansY[i], ansZ[i]);
  }
}
