#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool getmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
template <typename T>
inline bool getmax(T& a, const T& b) {
  return b > a ? (a = b, true) : false;
}
const int maxn = 1e5 + 5;
const long long INF = 4e18 + 5;
int n;
long long x[maxn], y[maxn], z[maxn];
inline bool check(const long long& Maxdis, long long& ansx, long long& ansy,
                  long long& ansz) {
  const long long sign[4][3] = {{1, 1, 1}, {-1, 1, 1}, {1, -1, 1}, {1, 1, -1}};
  long long L[4] = {-INF, -INF, -INF, -INF}, R[4] = {INF, INF, INF, INF};
  for (int i = 0; i < n; i++)
    for (int j = 0; j < 4; j++)
      getmax(L[j], sign[j][0] * x[i] + sign[j][1] * y[i] + sign[j][2] * z[i] -
                       Maxdis),
          getmin(R[j], sign[j][0] * x[i] + sign[j][1] * y[i] +
                           sign[j][2] * z[i] + Maxdis);
  for (int i = 0; i < 4; i++)
    if (L[i] > R[i]) return 0;
  for (int rep = 0; rep < 2; rep++) {
    long long A = L[1] + ((L[1] & 1) == rep), B = L[2] + ((L[2] & 1) == rep),
              C = L[3] + ((L[3] & 1) == rep);
    if (A <= R[1] && B <= R[2] && C <= R[3]) {
      bool flag = 0;
      if (A + B + C < L[0]) {
        long long dif = L[0] - A - B - C;
        if (dif & 1) dif++;
        if (A + B + C + dif > R[0]) continue;
        if (R[1] - A >= dif)
          A += dif, flag = 1;
        else {
          dif -= ((R[1] & 1) == rep ? R[1] - 1 : R[1]) - A;
          A = R[1];
          if ((A & 1) == rep) A--;
          if (R[2] - B >= dif)
            B += dif, flag = 1;
          else {
            dif -= ((R[2] & 1) == rep ? R[2] - 1 : R[2]) - B;
            B = R[2];
            if ((B & 1) == rep) B--;
            if (R[3] - C >= dif) C += dif, flag = 1;
          }
        }
      } else if (A + B + C <= R[0])
        flag = 1;
      if (flag) {
        assert((B + C) % 2 == 0 && (A + C) % 2 == 0 && (A + B) % 2 == 0);
        ansx = (B + C) / 2, ansy = (A + C) / 2, ansz = (A + B) / 2;
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%lld%lld%lld", x + i, y + i, z + i);
    long long L = 0, R = INF, ansx, ansy, ansz;
    while (L != R) {
      long long M = L + ((R - L) >> 1);
      if (check(M, ansx, ansy, ansz))
        R = M;
      else
        L = M + 1;
    }
    check(L, ansx, ansy, ansz);
    printf("%lld %lld %lld\n", ansx, ansy, ansz);
  }
}
