#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native")
using namespace std;
const int maxn = 100010;
int T, n;
long long x[maxn], y[maxn], z[maxn];
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      scanf("%lld %lld %lld", &x[i], &y[i], &z[i]);
    }
    if (n == 1) {
      printf("%lld %lld %lld\n", x[1], y[1], z[1]);
      continue;
    }
    long long px = 0, py = 0, pz = 0;
    auto solve = [&]() {
      long long t = 0;
      for (int i = 1; i <= n; i++)
        t = max(t, abs(px - x[i]) + abs(py - y[i]) + abs(pz - z[i]));
      return t;
    };
    long long ans = solve();
    for (long long d = 1e18; d;) {
      for (long long x : {-d, 0LL, d})
        for (long long y : {-d, 0LL, d}) {
          for (long long z : {-d, 0LL, d}) {
            px += x, py += y, pz += z;
            long long t = solve();
            if (t < ans) {
              ans = t;
              goto nxt;
            }
            px -= x, py -= y, pz -= z;
          }
        }
      d >>= 1;
    nxt:;
    }
    printf("%lld %lld %lld\n", px, py, pz);
  }
  return 0;
}
