#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int T, n;
struct nod {
  long long x, y, z;
} a[N], ans;
void get(long long *le, long long *ri, int o, long long x, long long mid) {
  le[o] = max(le[o], x - mid);
  ri[o] = min(ri[o], x + mid);
}
long long div(long long x) { return x < 0 ? (x - 1) / 2 : x / 2; }
bool ck(long long mid) {
  long long le[4], ri[4];
  for (int i = 0, _e = 3; i <= _e; ++i) le[i] = -8e18, ri[i] = 8e18;
  for (int i = 1, _e = n; i <= _e; ++i)
    for (int p = 0, _e = 1; p <= _e; ++p)
      for (int q = 0, _e = 1; q <= _e; ++q)
        get(le, ri, p * 2 + q,
            a[i].x + (p ? -a[i].y : a[i].y) + (q ? -a[i].z : a[i].z), mid);
  for (int i = 0, _e = 3; i <= _e; ++i)
    if (le[i] > ri[i]) return 0;
  long long mn = max(div(le[1] + le[2] + 1), div(le[0] + le[3] + 1)),
            mx = min(div(ri[1] + ri[2]), div(ri[0] + ri[3]));
  long long x, y, z;
  for (x = mn; x <= mx; ++x) {
    for (y = max(le[0] - x, x - ri[3]); y <= min(ri[0] - x, x - le[3]); ++y) {
      for (z = max(le[1] - x, x - ri[2]); z <= min(ri[1] - x, x - le[2]); ++z)
        if (~(y - z) & 1) break;
      if (z <= min(ri[1] - x, x - le[2])) break;
    }
    if (y <= min(ri[0] - x, x - le[3])) break;
  }
  if (x <= mx) {
    ans = (nod){x, (y + z) / 2, (y - z) / 2};
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  for (cin >> T; T--;) {
    cin >> n;
    for (int i = 1, _e = n; i <= _e; ++i) cin >> a[i].x >> a[i].y >> a[i].z;
    for (long long l = 0, r = 3e18, mid; mid = l + r >> 1, l <= r;)
      if (ck(mid))
        r = mid - 1;
      else
        l = mid + 1;
    printf("%lld %lld %lld\n", ans.x, ans.y, ans.z);
  }
}
