#include <bits/stdc++.h>
using namespace std;
template <typename tn>
void read(tn &a) {
  tn x = 0, f = 1;
  char c = ' ';
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  a = x * f;
}
const int N = 101000;
long long lim[8], lm[8];
int n;
struct point {
  long long x, y, z;
  long long getval(int k) {
    return x * (k & 1 ? -1 : 1) + y * (k >> 1 & 1 ? -1 : 1) +
           z * (k >> 2 & 1 ? -1 : 1);
  }
} p[N], ans;
bool chk(int tag, long long *lim) {
  long long l[4] = {(-lim[7] + 1 - 3 * tag) >> 1, (-lim[6] + 1 - tag) >> 1,
                    (-lim[5] + 1 - tag) >> 1, (-lim[3] + 1 - tag) >> 1};
  long long r[4] = {(lim[0] - 3 * tag) >> 1, (lim[1] - tag) >> 1,
                    (lim[2] - tag) >> 1, (lim[4] - tag) >> 1};
  long long a = l[1], b = l[2], c = l[3];
  for (int i = 0; i < 4; i++)
    if (r[i] < l[i]) return 0;
  if (a + b + c > r[0]) return 0;
  if (a + b + c < l[0]) {
    a = min(r[1], l[0] - b - c);
    b = min(r[2], l[0] - a - c);
    c = min(r[3], l[0] - a - b);
  }
  if (a + b + c < l[0]) return 0;
  ans = {b + c + tag, a + c + tag, a + b + tag};
  return 1;
}
bool check(long long len) {
  memcpy(lm, lim, sizeof(lm));
  for (int i = 0; i < 8; i++) lm[i] += len;
  if (chk(0, lm)) return 1;
  if (chk(1, lm)) return 1;
  return 0;
}
int main() {
  int T;
  read(T);
  while (T--) {
    read(n);
    for (int i = 1; i <= n; i++) read(p[i].x), read(p[i].y), read(p[i].z);
    memset(lim, 63, sizeof(lim));
    for (int i = 1; i <= n; i++)
      for (int j = 0; j < 8; j++) lim[j] = min(lim[j], p[i].getval(j));
    long long l = -1, r = 4e18l + 1;
    while (l + 1 < r) {
      long long mid = l + r >> 1;
      if (check(mid))
        r = mid;
      else
        l = mid;
    }
    check(r);
    cout << ans.x << ' ' << ans.y << ' ' << ans.z << '\n';
  }
  return 0;
}
