#include <bits/stdc++.h>
using namespace std;
long long Ma[4], Mi[4];
long long X = 0, Y = 0, Z = 0;
int n;
inline long long Dis(long long x, long long y, long long z) {
  long long ans = 0;
  if (X == -((long long)3 * 1e18) && Y == 0 && Z == 0) {
  }
  ans = max(ans, Ma[0] - (x + y + z));
  ans = max(ans, (x + y + z) - Mi[0]);
  ans = max(ans, Ma[1] - (x + y - z));
  ans = max(ans, (x + y - z) - Mi[1]);
  ans = max(ans, Ma[2] - (x - y + z));
  ans = max(ans, (x - y + z) - Mi[2]);
  ans = max(ans, Ma[3] - (x - y - z));
  ans = max(ans, (x - y - z) - Mi[3]);
  return ans;
}
inline void solve() {
  long long len = (long long)1e18;
  long long dis;
  X = Y = Z = 0;
  bool yy;
  for (; len;) {
    yy = 0;
    dis = Dis(X, Y, Z);
    for (int i = -1; i <= 1; ++i)
      for (int j = -1; j <= 1; ++j)
        for (int k = -1; k <= 1; ++k)
          if (!(i == 0 && j == 0 && k == 0)) {
            long long nx, ny, nz, Cup;
            nx = X + (long long)i * len;
            ny = Y + (long long)j * len;
            nz = Z + (long long)k * len;
            Cup = Dis(nx, ny, nz);
            if (dis > Cup) {
              X = nx;
              Y = ny;
              Z = nz;
              dis = Cup;
              yy = 1;
            }
          }
    if (yy == 0) len /= 2;
  }
  printf("%I64d %I64d %I64d\n", X, Y, Z);
}
inline void In() {
  scanf("%d", &n);
  long long x, y, z;
  for (int i = 0; i < 4; ++i)
    Ma[i] = -((long long)3 * 1e18), Mi[i] = ((long long)3 * 1e18);
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d %I64d %I64d\n", &x, &y, &z);
    if (n == 1) {
      X = x;
      Y = y;
      Z = z;
    }
    Ma[0] = max(Ma[0], x + y + z);
    Mi[0] = min(Mi[0], x + y + z);
    Ma[1] = max(Ma[1], x + y - z);
    Mi[1] = min(Mi[1], x + y - z);
    Ma[2] = max(Ma[2], x - y + z);
    Mi[2] = min(Mi[2], x - y + z);
    Ma[3] = max(Ma[3], x - y - z);
    Mi[3] = min(Mi[3], x - y - z);
  }
}
int main() {
  int T;
  scanf("%d", &T);
  for (int t = 1; t <= T; ++t) {
    In();
    if (n == 1)
      cout << X << " " << Y << " " << Z << endl;
    else
      solve();
  }
  return 0;
}
