#include <bits/stdc++.h>
using namespace std;
inline void proc_status() {
  ifstream t("/proc/self/status");
  cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>())
       << endl;
}
template <typename T>
inline int chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline int chkmax(T &a, const T &b) {
  return b > a ? a = b, 1 : 0;
}
template <typename T>
inline T sqr(const T &val) {
  return val * val;
}
namespace fastIO {
const int MAX_BUFFER_SIZE = 1 << 16;
char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;
inline char getc() {
  return *(cur == ed ? ed = buffer + fread(buffer, 1, MAX_BUFFER_SIZE, stdin),
           cur = buffer : cur)++;
}
}  // namespace fastIO
using fastIO::getc;
template <typename T>
inline T read() {
  register T sum(0), fg(1);
  register char ch(getc());
  for (; !isdigit(ch); ch = getc())
    if (ch == '-') fg = -1;
  for (; isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
  return sum * fg;
}
const int MAXN = (int)1e5;
struct point {
  long long x, y, z;
  point() {}
  point(long long _x, long long _y, long long _z) : x(_x), y(_y), z(_z) {}
};
int n;
point a[MAXN + 5];
inline void input() {
  n = read<int>();
  for (int i = 1; i <= n; ++i)
    a[i].x = read<long long>(), a[i].y = read<long long>(),
    a[i].z = read<long long>();
}
const long long INF = (long long)3e18;
inline int check(long long LIM) {
  long long l0 = -INF, r0 = INF;
  long long l1 = -INF, r1 = INF;
  long long l2 = -INF, r2 = INF;
  long long l3 = -INF, r3 = INF;
  for (int i = 1; i <= n; ++i) {
    long long x = a[i].x, y = a[i].y, z = a[i].z;
    chkmax(l0, x + y + z - LIM);
    chkmin(r0, x + y + z + LIM);
    chkmax(l1, -x + y + z - LIM);
    chkmin(r1, -x + y + z + LIM);
    chkmax(l2, x - y + z - LIM);
    chkmin(r2, x - y + z + LIM);
    chkmax(l3, x + y - z - LIM);
    chkmin(r3, x + y - z + LIM);
  }
  for (int t = 0; t < 2; ++t) {
    long long p0 = l0 - 3 * t, q0 = r0 - 3 * t;
    long long p1 = l1 - t, q1 = r1 - t;
    long long p2 = l2 - t, q2 = r2 - t;
    long long p3 = l3 - t, q3 = r3 - t;
    p0 = (long long)ceil((long double)p0 / 2),
    q0 = (long long)floor((long double)q0 / 2);
    p1 = (long long)ceil((long double)p1 / 2),
    q1 = (long long)floor((long double)q1 / 2);
    p2 = (long long)ceil((long double)p2 / 2),
    q2 = (long long)floor((long double)q2 / 2);
    p3 = (long long)ceil((long double)p3 / 2),
    q3 = (long long)floor((long double)q3 / 2);
    if (p0 <= q0 && p1 + p2 + p3 <= q0 && p0 <= q1 + q2 + q3 && p1 <= q1 &&
        p2 <= q2 && p3 <= q3)
      return 1;
  }
  return 0;
}
inline void output(long long LIM) {
  long long l0 = -INF, r0 = INF;
  long long l1 = -INF, r1 = INF;
  long long l2 = -INF, r2 = INF;
  long long l3 = -INF, r3 = INF;
  for (int i = 1; i <= n; ++i) {
    long long x = a[i].x, y = a[i].y, z = a[i].z;
    chkmax(l0, x + y + z - LIM);
    chkmin(r0, x + y + z + LIM);
    chkmax(l1, -x + y + z - LIM);
    chkmin(r1, -x + y + z + LIM);
    chkmax(l2, x - y + z - LIM);
    chkmin(r2, x - y + z + LIM);
    chkmax(l3, x + y - z - LIM);
    chkmin(r3, x + y - z + LIM);
  }
  for (int t = 0; t < 2; ++t) {
    long long p0 = l0 - 3 * t, q0 = r0 - 3 * t;
    long long p1 = l1 - t, q1 = r1 - t;
    long long p2 = l2 - t, q2 = r2 - t;
    long long p3 = l3 - t, q3 = r3 - t;
    p0 = (long long)ceil((long double)p0 / 2),
    q0 = (long long)floor((long double)q0 / 2);
    p1 = (long long)ceil((long double)p1 / 2),
    q1 = (long long)floor((long double)q1 / 2);
    p2 = (long long)ceil((long double)p2 / 2),
    q2 = (long long)floor((long double)q2 / 2);
    p3 = (long long)ceil((long double)p3 / 2),
    q3 = (long long)floor((long double)q3 / 2);
    if (p0 <= q0 && p1 + p2 + p3 <= q0 && p0 <= q1 + q2 + q3 && p1 <= q1 &&
        p2 <= q2 && p3 <= q3) {
      long long A = p1, B = p2, C = p3;
      if (A + B + C < p0) A += min(q1 - p1, p0 - A - B - C);
      if (A + B + C < p0) B += min(q2 - p2, p0 - A - B - C);
      if (A + B + C < p0) C += min(q3 - p3, p0 - A - B - C);
      long long x = B + C + t;
      long long y = A + C + t;
      long long z = A + B + t;
      printf("%lld %lld %lld\n", x, y, z);
      return;
    }
  }
}
inline void solve() {
  long long l = 0, r = INF;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  output(r);
}
int main() {
  for (int T = read<int>(); T--;) {
    input();
    solve();
  }
  return 0;
}
