#include <bits/stdc++.h>
using namespace std;
struct mat {
  long long x, y, z;
};
const int N = 100005;
const long long oo = 9223372036854775807LL;
int n;
mat p[N];
pair<long long, long long> e[4];
void combine(pair<long long, long long> &A, pair<long long, long long> B) {
  A.first = max(A.first, B.first), A.second = min(B.second, A.second);
}
mat check(long long d) {
  e[0] = e[1] = e[2] = e[3] = pair<long long, long long>(-oo, oo);
  for (int i = (1), _b = (n); i <= _b; i++) {
    long long s;
    s = p[i].x + p[i].y + p[i].z;
    combine(e[0], pair<long long, long long>(s - d, s + d));
    s = -p[i].x + p[i].y + p[i].z;
    combine(e[1], pair<long long, long long>(s - d, s + d));
    s = p[i].x - p[i].y + p[i].z;
    combine(e[2], pair<long long, long long>(s - d, s + d));
    s = p[i].x + p[i].y - p[i].z;
    combine(e[3], pair<long long, long long>(s - d, s + d));
  }
  mat ans = {oo, oo, oo};
  for (long long r = 0LL; r < 2; r++) {
    pair<long long, long long> t[4];
    for (int i = (1), _b = (3); i <= _b; i++) {
      if (((e[i].first - r) & 1) == 0)
        t[i].first = (e[i].first - r) / 2;
      else
        t[i].first = (e[i].first - r + 1LL) / 2;
      if (((e[i].second - r) & 1) == 0)
        t[i].second = (e[i].second - r) / 2;
      else
        t[i].second = (e[i].second - r - 1LL) / 2;
    }
    if (((e[0].first - r * 3) & 1) == 0)
      t[0].first = (e[0].first - r * 3) / 2;
    else
      t[0].first = (e[0].first - r * 3 + 1LL) / 2;
    if (((e[0].second - r * 3) & 1) == 0)
      t[0].second = (e[0].second - r * 3) / 2;
    else
      t[0].second = (e[0].second - r * 3 - 1LL) / 2;
    bool ok = true;
    for (int i = (0), _b = (3); i <= _b; i++)
      if (t[i].first > t[i].second) ok = false;
    if (!ok) continue;
    mat res = {t[1].first, t[2].first, t[3].first};
    long long delta = max(0LL, t[0].first - (res.x + res.y + res.z));
    res.x += min(delta, t[1].second - res.x);
    delta = max(0LL, t[0].first - (res.x + res.y + res.z));
    res.y += min(delta, t[2].second - res.y);
    delta = max(0LL, t[0].first - (res.x + res.y + res.z));
    res.z += min(delta, t[3].second - res.z);
    if (t[0].first <= res.x + res.y + res.z &&
        res.x + res.y + res.z <= t[0].second) {
      ans.x = res.y + res.z + r;
      ans.y = res.x + res.z + r;
      ans.z = res.x + res.y + r;
      break;
    }
  }
  return ans;
}
long long distance(mat h) {
  long long res = 0;
  for (int i = (1), _b = (n); i <= _b; i++)
    res = max(res, abs(h.x - p[i].x) + abs(h.y - p[i].y) + abs(h.z - p[i].z));
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int Test;
  cin >> Test;
  while (Test--) {
    cin >> n;
    for (int i = (1), _b = (n); i <= _b; i++) cin >> p[i].x >> p[i].y >> p[i].z;
    if (n == 1) {
      cout << p[1].x << ' ' << p[1].y << ' ' << p[1].z << '\n';
      continue;
    }
    long long low = 0LL, high = 3LL * round(1e18);
    while (low < high) {
      long long mid = (low + high) / 2;
      if (check(mid).x != oo)
        high = mid;
      else
        low = mid + 1LL;
    }
    mat res = check(low);
    cout << res.x << ' ' << res.y << ' ' << res.z << '\n';
  }
}
