#include <bits/stdc++.h>
const long long MAX = (long long)3.01e18;
const long long INF = (long long)9.01e18;
const int N = 1234567;
using namespace std;
int n;
long long x[N], y[N], z[N], X, Y, Z;
bool work(long long la, long long ua, long long lb, long long ub, long long lc,
          long long uc, long long ls, long long us, long long yu) {
  if ((la & 1) != yu) {
    la++;
  }
  if ((lb & 1) != yu) {
    lb++;
  }
  if ((lc & 1) != yu) {
    lc++;
  }
  if ((ls & 1) != yu) {
    ls++;
  }
  if ((ua & 1) != yu) {
    ua--;
  }
  if ((ub & 1) != yu) {
    ub--;
  }
  if ((uc & 1) != yu) {
    uc--;
  }
  if ((us & 1) != yu) {
    us--;
  }
  if (la > ua || lb > ub || lc > uc || ls > us) return false;
  if (la + lb + lc > us) return false;
  if (ua + ub + uc < ls) return false;
  if (ls <= la + lb + lc) {
    X = (lb + lc) / 2;
    Y = (la + lc) / 2;
    Z = (la + lb) / 2;
    return true;
  }
  long long x = ls - la - lb - lc;
  long long a = min(x + la, ua);
  x -= -la + a;
  long long b = min(x + lb, ub);
  x -= -lb + b;
  long long c = x + lc;
  X = (b + c) / 2;
  Y = (a + c) / 2;
  Z = (a + b) / 2;
  return true;
}
bool can(long long o) {
  long long la = -INF, lb = -INF, lc = -INF, ls = -INF;
  long long ua = INF, ub = INF, uc = INF, us = INF;
  for (int i = 0; i < n; ++i) {
    la = max(la, (-x[i] + y[i] + z[i]) - o);
    ua = min(ua, (-x[i] + y[i] + z[i]) + o);
    lb = max(lb, (x[i] - y[i] + z[i]) - o);
    ub = min(ub, (x[i] - y[i] + z[i]) + o);
    lc = max(lc, (x[i] + y[i] - z[i]) - o);
    uc = min(uc, (x[i] + y[i] - z[i]) + o);
    ls = max(ls, (-x[i] + y[i] + z[i]) + (x[i] - y[i] + z[i]) +
                     (x[i] + y[i] - z[i]) - o);
    us = min(us, (-x[i] + y[i] + z[i]) + (x[i] - y[i] + z[i]) +
                     (x[i] + y[i] - z[i]) + o);
  }
  bool ok = false;
  ok |= work(la, ua, lb, ub, lc, uc, ls, us, 0);
  ok |= work(la, ua, lb, ub, lc, uc, ls, us, 1);
  return ok;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    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 = MAX;
    while (L < R) {
      long long mid = (L + R) >> 1;
      if (can(mid)) {
        R = mid;
      } else {
        L = mid + 1;
      }
    }
    can(L);
    printf("%lld %lld %lld\n", X, Y, Z);
  }
  return 0;
}
