#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long inf = 6e18;
int n;
long long x[N], y[N], z[N];
long long ansx, ansy, ansz;
void ckmax(long long &x, long long y) {
  if (x < y) x = y;
}
void ckmin(long long &x, long long y) {
  if (x > y) x = y;
}
int chk(long long X, long long L) {
  long long l = -inf, r = inf, u = -inf, d = inf;
  for (int i = (1), _x = (n); i <= _x; i++) {
    long long S = L - abs(x[i] - X);
    if (S < 0) return 0;
    long long nx = y[i] + z[i], ny = z[i] - y[i];
    ckmax(u, nx - S), ckmin(d, nx + S), ckmax(l, ny - S), ckmin(r, ny + S);
    if (u > d || l > r) return 0;
  }
  long long ax, ay;
  if (u == d) {
    if ((u & 1) ^ (l & 1)) l++;
    if (l > r) return 0;
    ax = u, ay = l;
  } else {
    if ((u & 1) ^ (l & 1)) u++;
    ax = u, ay = l;
  }
  ansz = (ax + ay) / 2;
  ansy = (ax - ay) / 2;
  return 1;
}
int even(long long l[4], long long r[4], long long &x, long long &y,
         long long &z) {
  for (int i = (0), _x = (3); i <= _x; i++) {
    if (l[i] & 1) l[i]++;
    if (r[i] & 1) r[i]--;
    if (l[i] > r[i]) return 0;
    l[i] /= 2, r[i] /= 2;
  }
  l[3] += l[0], r[3] += r[0];
  long long mn = l[1] + l[2], mx = r[1] + r[2];
  ckmax(mn, l[3]), ckmin(mx, r[3]);
  if (mn > mx) return 0;
  y = min(r[1], mn - l[2]);
  z = mn - y;
  l[3] -= l[0], r[3] -= r[0];
  mn = -r[0], mx = -l[0];
  ckmax(mn, l[3] - y - z);
  ckmin(mx, r[3] - y - z);
  if (mn > mx) return 0;
  x = -mx;
  x *= 2, y *= 2, z *= 2;
  return 1;
}
int odd(long long l[4], long long r[4], long long &x, long long &y,
        long long &z) {
  for (int i = (0), _x = (3); i <= _x; i++) {
    l[i]++, r[i]++;
    if (l[i] & 1) l[i]++;
    if (r[i] & 1) r[i]--;
    if (l[i] > r[i]) return 0;
    l[i] /= 2, r[i] /= 2;
  }
  l[3] += l[0], r[3] += r[0];
  long long mn = l[1] + l[2], mx = r[1] + r[2];
  ckmax(mn, l[3]), ckmin(mx, r[3]);
  if (mn > mx) return 0;
  y = min(r[1], mn - l[2]);
  z = mn - y;
  l[3] -= l[0], r[3] -= r[0];
  mn = -r[0], mx = -l[0];
  ckmax(mn, l[3] - y - z);
  ckmin(mx, r[3] - y - z);
  if (mn > mx) return 0;
  x = -mx;
  x = x * 2 - 1, y = y * 2 - 1, z = z * 2 - 1;
  return 1;
}
int check(long long L) {
  long long l[4], r[4], tmp1[4], tmp2[4];
  for (int i = (0), _x = (3); i <= _x; i++) l[i] = -inf, r[i] = inf;
  for (int i = (1), _x = (n); i <= _x; i++) {
    ckmax(l[0], x[i] + y[i] + z[i] - L);
    ckmin(r[0], x[i] + y[i] + z[i] + L);
    ckmax(l[1], x[i] + y[i] - z[i] - L);
    ckmin(r[1], x[i] + y[i] - z[i] + L);
    ckmax(l[2], x[i] - y[i] + z[i] - L);
    ckmin(r[2], x[i] - y[i] + z[i] + L);
    ckmax(l[3], x[i] - y[i] - z[i] - L);
    ckmin(r[3], x[i] - y[i] - z[i] + L);
  }
  for (int i = (0), _x = (3); i <= _x; i++)
    if (l[i] > r[i]) return 0;
  memcpy(tmp1, l, sizeof(l));
  memcpy(tmp2, r, sizeof(r));
  long long nx = 0, ny = 0, nz = 0;
  if (!(even(l, r, nx, ny, nz) || odd(tmp1, tmp2, nx, ny, nz))) return 0;
  ansx = (ny + nz) / 2, ansy = (nx - nz) / 2, ansz = (nx - ny) / 2;
  return 1;
}
void work() {
  cin >> n;
  for (int i = (1), _x = (n); i <= _x; i++) cin >> x[i] >> y[i] >> z[i];
  long long l = 0, r = 3e18, best = r;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      best = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  check(best);
  cout << ansx << " " << ansy << " " << ansz << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int T;
  for (cin >> T; T--;) work();
  return 0;
}
