#include <bits/stdc++.h>
using namespace std;
long long x[100005], y[100005], z[100005];
long long A, B, C;
int n;
void upd(pair<long long, long long> &s, long long l, long long r) {
  s.first = max(s.first, l);
  s.second = min(s.second, r);
  if (s.first % 2) s.first++;
  if (s.second % 2) s.second--;
}
bool solve(long long mid) {
  for (int r = 0; r < 2; r++) {
    pair<long long, long long> a(-((long long)4e18), ((long long)4e18)), b, c,
        d;
    b = c = d = a;
    for (int i = 1; i <= n; i++) {
      long long p = -x[i] + y[i] + z[i];
      upd(a, p - mid - r, p + mid - r);
      p = x[i] - y[i] + z[i];
      upd(b, p - mid - r, p + mid - r);
      p = x[i] + y[i] - z[i];
      upd(c, p - mid - r, p + mid - r);
      p = x[i] + y[i] + z[i];
      upd(d, p - mid - 3 * r, p + mid - 3 * r);
    }
    upd(d, a.first + b.first + c.first, a.second + b.second + c.second);
    if (a.first > a.second || b.first > b.second || c.first > c.second ||
        d.first > d.second)
      continue;
    long long sa = min(a.second, d.first - b.first - c.first);
    long long sb = min(b.second, d.first - c.first - sa);
    long long sc = d.first - sa - sb;
    A = (sb + sc) / 2 + r;
    B = (sa + sc) / 2 + r;
    C = (sa + sb) / 2 + r;
    return 1;
  }
  return 0;
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%I64d%I64d%I64d", &x[i], &y[i], &z[i]);
    long long l = 0, r = ((long long)4e18), ans;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if (solve(mid))
        ans = mid, r = mid - 1;
      else
        l = mid + 1;
    }
    solve(ans);
    printf("%I64d %I64d %I64d\n", A, B, C);
  }
}
