#include <bits/stdc++.h>
static const long long INF64 = 1LL << 62;
static const int MAXN = 100008;
template <typename T>
inline T min(const T a, const T b) {
  return a < b ? a : b;
}
template <typename T>
inline T max(const T a, const T b) {
  return a > b ? a : b;
}
struct coord {
  long long x, y, z;
  coord() : x(INF64), y(INF64), z(INF64) {}
  coord(long long x, long long y = 0, long long z = 0) : x(x), y(y), z(z) {}
};
struct ineq {
  long long al, ar, bl, br, cl, cr, sl, sr;
  ineq(long long al = -INF64, long long ar = INF64, long long bl = -INF64,
       long long br = INF64, long long cl = -INF64, long long cr = INF64,
       long long sl = -INF64, long long sr = INF64)
      : al(al), ar(ar), bl(bl), br(br), cl(cl), cr(cr), sl(sl), sr(sr) {}
  inline ineq intersect(const ineq &other) {
    return ineq(max(al, other.al), min(ar, other.ar), max(bl, other.bl),
                min(br, other.br), max(cl, other.cl), min(cr, other.cr),
                max(sl, other.sl), min(sr, other.sr));
  }
  inline bool valid() {
    return al <= ar && bl <= br && cl <= cr && sl <= sr &&
           (al + bl + cl <= sr) && (ar + br + cr >= sl);
  }
  inline coord solve() {
    if (!valid()) return coord(INF64, INF64, INF64);
    coord ret(al, bl, cl);
    if (ret.x + ret.y + ret.z < sr)
      ret.x += min(sr - (ret.x + ret.y + ret.z), ar - al);
    if (ret.x + ret.y + ret.z < sr)
      ret.y += min(sr - (ret.x + ret.y + ret.z), br - bl);
    if (ret.x + ret.y + ret.z < sr)
      ret.z += min(sr - (ret.x + ret.y + ret.z), cr - cl);
    return ret;
  }
};
int n;
coord p[MAXN];
template <typename T>
inline T wipe_parity(const T x) {
  return x - (x & 1);
}
coord check(long long dist) {
  ineq e;
  coord sol;
  for (int i = 0; i < n; ++i) {
    ineq w(p[i].x + p[i].y - p[i].z - dist, p[i].x + p[i].y - p[i].z + dist,
           p[i].x - p[i].y + p[i].z - dist, p[i].x - p[i].y + p[i].z + dist,
           -p[i].x + p[i].y + p[i].z - dist, -p[i].x + p[i].y + p[i].z + dist,
           p[i].x + p[i].y + p[i].z - dist, p[i].x + p[i].y + p[i].z + dist);
    e = e.intersect(w);
  }
  for (int p = 0; p <= 1; ++p) {
    ineq w = ineq(wipe_parity(e.al - p + 1) >> 1, wipe_parity(e.ar - p) >> 1,
                  wipe_parity(e.bl - p + 1) >> 1, wipe_parity(e.br - p) >> 1,
                  wipe_parity(e.cl - p + 1) >> 1, wipe_parity(e.cr - p) >> 1,
                  wipe_parity(e.sl - p * 3 + 1) >> 1,
                  wipe_parity(e.sr - p * 3) >> 1);
    if ((sol = w.solve()).x != INF64) {
      sol.x = sol.x * 2 + p;
      sol.y = sol.y * 2 + p;
      sol.z = sol.z * 2 + p;
      return coord((sol.x + sol.y) / 2, (sol.x + sol.z) / 2,
                   (sol.y + sol.z) / 2);
    }
  }
  return coord(INF64, INF64, INF64);
}
void work() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    scanf("%I64d%I64d%I64d", &p[i].x, &p[i].y, &p[i].z);
  long long lo = -1, hi = 3e18 + 2016, mid;
  while (lo < hi - 1) {
    mid = (lo + hi) >> 1;
    if (check(mid).x != INF64)
      hi = mid;
    else
      lo = mid;
  }
  coord ans = check(hi);
  printf("%I64d %I64d %I64d\n", ans.x, ans.y, ans.z);
}
int main() {
  int T;
  scanf("%d", &T);
  do work();
  while (--T);
  return 0;
}
