#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3f;
long long T, n, mxx, mix, mxy, miy, mxz, miz, mxs, mis;
long long ax, ay, az;
long long chk(long long x) {
  long long la, lb, lc, ra, rb, rc, sl, sr;
  long long tla, tlb, tlc, tra, trb, trc, tsl, tsr;
  la = mxx;
  ra = mix;
  lb = mxy;
  rb = miy;
  lc = mxz;
  rc = miz;
  sl = mxs;
  sr = mis;
  la -= x;
  lb -= x;
  lc -= x;
  sl -= x;
  ra += x;
  rb += x;
  rc += x;
  sr += x;
  if (sl > sr || la > ra || lb > rb || lc > rc) return 0;
  for (long long i = 0; i < 2; i++) {
    tla = la;
    tlb = lb;
    tlc = lc;
    tsl = sl;
    tra = ra;
    trb = rb;
    trc = rc;
    tsr = sr;
    if (((sl & 1) && !i) || ((!(sl & 1)) && i)) tsl = sl + 1;
    if (((sr & 1) && !i) || ((!(sr & 1)) && i)) tsr = sr - 1;
    if (((la & 1) && !i) || ((!(la & 1)) && i)) tla = la + 1;
    if (((lb & 1) && !i) || ((!(lb & 1)) && i)) tlb = lb + 1;
    if (((lc & 1) && !i) || ((!(lc & 1)) && i)) tlc = lc + 1;
    if (((ra & 1) && !i) || ((!(ra & 1)) && i)) tra = ra - 1;
    if (((rb & 1) && !i) || ((!(rb & 1)) && i)) trb = rb - 1;
    if (((rc & 1) && !i) || ((!(rc & 1)) && i)) trc = rc - 1;
    if (tsl > tsr || tla > tra || tlb > trb || tlc > trc) continue;
    if (tla + tlb + tlc > tsr || tra + trb + trc < tsl) continue;
    if (tla + tlb + tlc < tsl)
      tla = (tsl - tlb - tlc <= tra) ? tsl - tlb - tlc : tra;
    if (tla + tlb + tlc < tsl)
      tlb = (tsl - tla - tlc <= trb) ? tsl - tla - tlc : trb;
    if (tla + tlb + tlc < tsl)
      tlc = (tsl - tla - tlb <= trc) ? tsl - tla - tlb : trc;
    ax = (tlb + tlc) >> 1;
    ay = (tla + tlc) >> 1;
    az = (tla + tlb) >> 1;
    return 1;
  }
  return 0;
}
int main() {
  long long x, y, z, l, r, mid, ans;
  cin >> T;
  while (T--) {
    mxx = mxy = mxz = mxs = -INF;
    mix = miy = miz = mis = INF;
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> x >> y >> z;
      mxs = max(mxs, x + y + z);
      mis = min(mis, x + y + z);
      mxx = max(mxx, y + z - x);
      mix = min(mix, y + z - x);
      mxy = max(mxy, x - y + z);
      miy = min(miy, x - y + z);
      mxz = max(mxz, x + y - z);
      miz = min(miz, x + y - z);
    }
    l = 0;
    r = INF;
    while (l <= r) {
      mid = (l + r) >> 1;
      if (chk(mid)) {
        ans = mid;
        r = mid - 1;
      } else
        l = mid + 1;
    }
    chk(ans);
    cout << ax << ' ' << ay << ' ' << az << '\n';
  }
  return 0;
}
