#include <bits/stdc++.h>
using namespace std;
long long x[111111];
long long y[111111];
long long z[111111];
long long mx[4];
long long mn[4];
long long aa, ab, ac;
bool check(long long A) {
  long long cmn[4];
  long long cmx[4];
  for (int m2 = 0; m2 < 2; m2++) {
    bool ok = true;
    for (int i = 0; i < 4; i++) {
      long long v = mx[i] - A;
      if ((v & 1) != m2) {
        v++;
      }
      cmn[i] = v;
      v = mn[i] + A;
      if ((v & 1) != m2) {
        v--;
      }
      cmx[i] = v;
      if (cmn[i] > cmx[i]) {
        ok = false;
        break;
      }
    }
    if (!ok) {
      continue;
    }
    long long mnD = cmn[1] + cmn[2] - cmx[0];
    long long mxD = cmx[1] + cmx[2] - cmn[0];
    if (mxD < cmn[3] || cmx[3] < mnD) {
      continue;
    }
    ab = cmn[1];
    ac = cmn[2];
    aa = cmx[0];
    if (mnD < cmn[3]) {
      long long d = cmn[3] - mnD;
      long long t = min(d, aa - cmn[0]);
      aa -= t;
      d -= t;
      t = min(d, cmx[1] - ab);
      ab += t;
      d -= t;
      t = min(d, cmx[2] - ac);
      ac += t;
      d -= t;
      if (d != 0) {
        cerr << ":("
             << "\n";
      }
    }
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  int coef[4][3] = {{1, 1, 1}, {1, 1, -1}, {1, -1, 1}, {1, -1, -1}};
  while (t-- > 0) {
    int n;
    cin >> n;
    for (int i = 0; i < 4; i++) {
      mx[i] = -5e18;
      mn[i] = 5e18;
    }
    for (int i = 0; i < n; i++) {
      cin >> x[i] >> y[i] >> z[i];
      for (int j = 0; j < 4; j++) {
        long long v = x[i] * coef[j][0] + y[i] * coef[j][1] + z[i] * coef[j][2];
        mx[j] = max(mx[j], v);
        mn[j] = min(mn[j], v);
      }
    }
    long long l = -1, r = 3e18;
    while (l + 1 < r) {
      long long m = (l + r) >> 1;
      if (check(m)) {
        r = m;
      } else {
        l = m;
      }
    }
    check(r);
    long long ax = (ab + ac) / 2;
    long long ay = (aa - ac) / 2;
    long long az = (aa - ab) / 2;
    cout << ax << " " << ay << " " << az << "\n";
  }
  return 0;
}
