#include <bits/stdc++.h>
using namespace std;
int tc, n;
long long x[100005], y[100005], z[100005], sx, sy, sz;
pair<long long, long long> v[4], t[4], tt[4];
bool soln(long long md) {
  for (int i = (0); i <= (3); i++)
    v[i] = make_pair(tt[i].first - md, tt[i].second + md);
  for (int m2 = (0); m2 <= (1); m2++) {
    bool ok = true;
    for (int j = (0); j <= (3); j++) {
      t[j] = v[j];
      if (m2) {
        if (j == 0)
          t[j].first -= 3, t[j].second -= 3;
        else
          t[j].first--, t[j].second--;
      }
      if (t[j].first & 1) t[j].first++;
      if (t[j].second & 1) t[j].second--;
      t[j].first /= 2;
      t[j].second /= 2;
      if (t[j].first > t[j].second) {
        ok = false;
        break;
      }
    }
    if (!ok) continue;
    long long sol[3], sum = 0;
    for (int j = (0); j <= (2); j++) {
      assert(fabs((double)sum + sol[j]) < 9.1E18);
      sol[j] = t[j + 1].first, sum += sol[j];
    }
    if (sum > t[0].second) continue;
    for (int j = (0); j <= (2); j++)
      if (sum < t[0].first) {
        if (sum < t[0].first - (t[j + 1].second - sol[j])) {
          sum = sum + (t[j + 1].second - sol[j]);
          sol[j] = t[j + 1].second;
        } else {
          sol[j] += t[0].first - sum;
          sum = t[0].first;
          break;
        }
      }
    if (sum < t[0].first) continue;
    sx = (sol[1] + sol[2]) + m2;
    sy = (sol[0] + sol[2]) + m2;
    sz = (sol[0] + sol[1]) + m2;
    return true;
  }
  return false;
}
void solve() {
  long long lt = -1, rt = 3.001E18;
  while (rt - lt > 1) {
    long long md = (lt + rt) / 2;
    if (soln(md))
      rt = md;
    else
      lt = md;
  }
  soln(rt);
  printf("%lld %lld %lld\n", sx, sy, sz);
  return;
}
int main() {
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d", &n);
    for (int i = (0); i <= (3); i++) tt[i] = make_pair(-3.001E18, 3.001E18);
    for (int i = (1); i <= (n); i++) {
      scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
      for (int j = (0); j <= (3); j++) {
        long long cv = 0;
        cv += x[i] * (1 - 2 * (j == 1));
        cv += y[i] * (1 - 2 * (j == 2));
        cv += z[i] * (1 - 2 * (j == 3));
        tt[j].first = max(tt[j].first, cv);
        tt[j].second = min(tt[j].second, cv);
      }
    }
    solve();
  }
  return 0;
}
