#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, T;
long long X[N], Y[N], Z[N];
long long w[8], sx, sy, sz;
inline bool check(long long k) {
  for (int _ = (0); _ <= (1); ++_) {
    long long aL = -w[4] - k, bL = -w[2] - k, cL = -w[1] - k, aR = w[3] + k,
              bR = w[5] + k, cR = w[6] + k;
    long long sL = -w[0] - k, sR = w[7] + k;
    if ((aL & 1) != _) ++aL;
    if ((bL & 1) != _) ++bL;
    if ((cL & 1) != _) ++cL;
    if ((sL & 1) != _) ++sL;
    if ((aR & 1) != _) --aR;
    if ((bR & 1) != _) --bR;
    if ((cR & 1) != _) --cR;
    if ((sR & 1) != _) --sR;
    if (aL > aR || bL > bR || cL > cR || sL > sR || aL + bL + cL > sR ||
        aR + bR + cR < sL)
      continue;
    long long a = aL, b = bL, c = cL;
    if (aR + b + c <= sR)
      a = aR;
    else
      a = a + (sR - a - b - c);
    if (a + bR + c <= sR)
      b = bR;
    else
      b = b + (sR - a - b - c);
    if (a + b + cR <= sR)
      c = cR;
    else
      c = c + (sR - a - b - c);
    sx = b + c >> 1, sy = a + c >> 1, sz = a + b >> 1;
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  for (cin >> T; T--;) {
    cin >> n;
    for (int i = (1); i <= (n); ++i) cin >> X[i] >> Y[i] >> Z[i];
    memset(w, 0x3f, sizeof w);
    for (int _1 = (0); _1 <= (1); ++_1)
      for (int _2 = (0); _2 <= (1); ++_2)
        for (int _3 = (0); _3 <= (1); ++_3) {
          long long& s = w[(_1 << 2) | (_2 << 1) | _3];
          for (int i = (1); i <= (n); ++i) {
            long long k = (X[i] * (_1 ? 1 : -1)) + (Y[i] * (_2 ? 1 : -1)) +
                          (Z[i] * (_3 ? 1 : -1));
            s = min(s, k);
          }
        }
    long long l = 0, r = 3e18, ans = 3e18;
    while (l <= r) {
      const long long mid = l + r >> 1;
      if (check(mid))
        r = (ans = mid) - 1;
      else
        l = mid + 1;
    }
    check(ans);
    cout << sx << ' ' << sy << ' ' << sz << '\n';
  }
  return 0;
}
