#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T Abs(const T& x) {
  return x < 0 ? -x : x;
}
template <class T>
inline T Sqr(const T& x) {
  return x * x;
}
template <class... Args>
void ReadLong(long long& x, Args&... args) {
  scanf("%" SCNd64, &x);
  ReadLong(args...);
}
template <>
void ReadLong(long long& x) {
  scanf("%" SCNd64, &x);
}
template <class... Args>
void PrintLong(long long x, Args... args) {
  printf("%" PRId64 " ", x);
  PrintLong(args...);
}
template <>
void PrintLong<>(long long x) {
  printf("%" PRId64, x);
}
const long long inf = 3.01e18;
struct TPoint {
  long long X, Y, Z;
  TPoint(long long x = 0, long long y = 0, long long z = 0) {
    X = x, Y = y, Z = z;
  }
};
void FindMaxMin(long long xx, long long yy, long long zz,
                const vector<TPoint>& points, long long& mx, long long& mn) {
  mx = -inf;
  mn = +inf;
  for (const TPoint& p : points) {
    mx = max(mx, p.X * xx + p.Y * yy + p.Z * zz);
    mn = min(mn, p.X * xx + p.Y * yy + p.Z * zz);
  }
}
inline long long RoundUp(long long x, long long mod) {
  return (Abs(x % 2) != mod ? x + 1 : x);
}
inline long long RoundDown(long long x, long long mod) {
  return (Abs(x % 2) != mod ? x - 1 : x);
}
long long amx, amn, bmx, bmn, cmx, cmn, dmx, dmn;
bool Fit(long long r, TPoint& ans) {
  for (long long mod = 0; mod < 2; ++mod) {
    long long la = RoundUp(amx - r, mod), ra = RoundDown(amn + r, mod);
    long long lb = RoundUp(bmx - r, mod), rb = RoundDown(bmn + r, mod);
    long long lc = RoundUp(cmx - r, mod), rc = RoundDown(cmn + r, mod);
    long long ld = RoundUp(dmx - r, mod), rd = RoundDown(dmn + r, mod);
    if (la > ra || lb > rb || lc > rc || ld > rd) {
      continue;
    }
    long long b = lb, c = lc, d = ld;
    long long a = b + c + d;
    if (a > ra) {
      continue;
    } else if (a < la) {
      long long add = min(la - a, rb - b);
      b += add, a += add;
      add = min(la - a, rc - c);
      c += add, a += add;
      add = min(la - a, rd - d);
      d += add, a += add;
    }
    if (a < la) {
      continue;
    } else {
      ans.X = (b + c) / 2;
      ans.Y = (b + d) / 2;
      ans.Z = (c + d) / 2;
      return true;
    }
  }
  return false;
}
void Solution() {
  int n;
  cin >> n;
  vector<TPoint> points(n);
  for (int i = 0; i < n; ++i) {
    ReadLong(points[i].X, points[i].Y, points[i].Z);
  }
  FindMaxMin(+1, +1, +1, points, amx, amn);
  FindMaxMin(+1, +1, -1, points, bmx, bmn);
  FindMaxMin(+1, -1, +1, points, cmx, cmn);
  FindMaxMin(-1, +1, +1, points, dmx, dmn);
  TPoint ans;
  long long l = -1, r = inf;
  while (l + 1 < r) {
    long long m = l + (r - l) / 2;
    if (Fit(m, ans)) {
      r = m;
    } else {
      l = m;
    }
  }
  Fit(r, ans);
  PrintLong(ans.X, ans.Y, ans.Z);
  printf("\n");
}
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    Solution();
  }
  return 0;
}
