#include <bits/stdc++.h>
using namespace std;
const double PI = 4 * atan(1);
int T, N;
long long X[100013], Y[100013], Z[100013];
long long xmi, xma, ymi, yma, zmi, zma, smi, sma;
long long ansx, ansy, ansz;
inline bool is(long long x, int p) { return (((x % 2) + 2) % 2) == p; }
bool go(long long d) {
  xmi = -8.1e18, xma = 8.1e18, ymi = -8.1e18, yma = 8.1e18, zmi = -8.1e18,
  zma = 8.1e18, smi = -8.1e18, sma = 8.1e18;
  for (int i = 0; i < N; i++) {
    xmi = max(xmi, Y[i] + Z[i] - X[i] - d);
    xma = min(xma, Y[i] + Z[i] - X[i] + d);
    ymi = max(ymi, -Y[i] + Z[i] + X[i] - d);
    yma = min(yma, -Y[i] + Z[i] + X[i] + d);
    zmi = max(zmi, Y[i] - Z[i] + X[i] - d);
    zma = min(zma, Y[i] - Z[i] + X[i] + d);
    smi = max(smi, Y[i] + Z[i] + X[i] - d);
    sma = min(sma, Y[i] + Z[i] + X[i] + d);
  }
  if (smi > sma || xmi > xma || ymi > yma || zmi > zma) return false;
  for (int p = 0; p < 2; p++) {
    if (smi == sma && is(smi, !p) || xmi == xma && is(xmi, !p) ||
        ymi == yma && is(ymi, !p) || zmi == zma && is(zmi, !p))
      continue;
    long long qmi = 0;
    qmi += (is(xmi, p) ? xmi : xmi + 1);
    qmi += (is(ymi, p) ? ymi : ymi + 1);
    qmi += (is(zmi, p) ? zmi : zmi + 1);
    long long qma = 0;
    qma += (is(xma, p) ? xma : xma - 1);
    qma += (is(yma, p) ? yma : yma - 1);
    qma += (is(zma, p) ? zma : zma - 1);
    if (qmi <= qma && qmi <= sma && qma >= smi) {
      if (qmi >= smi) {
        ansx = (is(xmi, p) ? xmi : xmi + 1);
        ansy = (is(ymi, p) ? ymi : ymi + 1);
        ansz = (is(zmi, p) ? zmi : zmi + 1);
      } else if (qma <= sma) {
        ansx = (is(xma, p) ? xma : xma - 1);
        ansy = (is(yma, p) ? yma : yma - 1);
        ansz = (is(zma, p) ? zma : zma - 1);
      } else {
        xmi += is(xmi, !p);
        xma -= is(xma, !p);
        ymi += is(ymi, !p);
        yma -= is(yma, !p);
        zmi += is(zmi, !p);
        zma -= is(zma, !p);
        smi += is(smi, !p);
        sma -= is(sma, !p);
        if (xma + ymi + zmi < smi) {
          if (xma + yma + zmi < smi) {
            ansx = xma;
            ansy = yma;
            ansz = smi - ansx - ansy;
          } else {
            ansx = xma;
            ansz = zmi;
            ansy = smi - ansx - ansz;
          }
        } else {
          ansy = ymi;
          ansz = zmi;
          ansx = smi - ymi - zmi;
        }
      }
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> T;
  while (T--) {
    cin >> N;
    for (int i = 0; i < N; i++) {
      cin >> X[i] >> Y[i] >> Z[i];
    }
    long long lo = 0;
    long long hi = 3.1e18;
    while (lo != hi) {
      long long mid = (lo + hi) / 2;
      if (go(mid)) {
        hi = mid;
      } else {
        lo = mid + 1;
      }
    }
    go(lo);
    cout << (ansy + ansz) / 2 << ' ' << (ansx + ansz) / 2 << ' '
         << (ansx + ansy) / 2 << '\n';
  }
  cout.flush();
  return 0;
}
