#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
inline long long read() {
  long long s = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') ch = getchar(), f = -1;
  while (isdigit(ch)) s = s * 10 + ch - '0', ch = getchar();
  return ~f ? s : -s;
}
inline void myassert(bool a, string s) {
  if (!a) cerr << s << endl, exit(0);
}
const int maxn = 1e5 + 20;
int n;
long long A[maxn][5];
inline void init() {
  n = read();
  for (int i = (1), _end_ = (n); i <= _end_; i++) {
    long long x = read(), y = read(), z = read();
    A[i][1] = x + y + z;
    A[i][2] = x + y - z;
    A[i][3] = x - y + z;
    A[i][4] = x - y - z;
  }
}
long long Ans[4];
inline bool check(long long mid) {
  long long L[5], R[5];
  for (int i = (1), _end_ = (4); i <= _end_; i++)
    L[i] = A[1][i] - mid, R[i] = A[1][i] + mid;
  for (int j = (2), _end_ = (n); j <= _end_; j++) {
    for (int i = (1), _end_ = (4); i <= _end_; i++) {
      chkmax(L[i], A[j][i] - mid);
      chkmin(R[i], A[j][i] + mid);
    }
  }
  long long LL[5], RR[5], B[5];
  for (int op = 0; op < 2; op++) {
    int ok = 1;
    for (int i = (1), _end_ = (4); i <= _end_; i++) {
      LL[i] = L[i], RR[i] = R[i];
      if (LL[i] + op & 1) LL[i]++;
      if (RR[i] + op & 1) RR[i]--;
      if (LL[i] > RR[i]) ok = 0;
    }
    chkmax(LL[4], LL[2] + LL[3] - RR[1]);
    chkmin(RR[4], RR[2] + RR[3] - LL[1]);
    if (LL[4] > RR[4]) ok = 0;
    if (!ok) continue;
    B[2] = LL[2];
    B[3] = LL[3];
    B[1] = RR[1];
    B[4] = LL[2] + LL[3] - RR[1];
    long long cha = LL[4] - B[4];
    if (cha > 0) {
      if (RR[1] - LL[1] >= cha)
        B[1] -= cha;
      else {
        B[1] = LL[1], cha -= RR[1] - LL[1];
        if (RR[2] - LL[2] >= cha)
          B[2] += cha;
        else {
          B[2] = RR[2], cha -= RR[2] - LL[2];
          B[3] += cha;
        }
      }
    }
    B[4] = B[2] + B[3] - B[1];
    myassert(LL[4] <= B[4] && B[4] <= RR[4], "fake at 85");
    {
      Ans[1] = B[2] + B[3] >> 1;
      Ans[2] = B[1] - B[3] >> 1;
      Ans[3] = B[1] - B[2] >> 1;
      return 1;
    }
  }
  return 0;
}
inline void doing() {
  long long l = 0, r = 4e18;
  while (l < r) {
    long long mid = l + (r - l >> 1);
    if (check(mid))
      r = mid;
    else
      l = mid + 1;
  }
  for (int i = (1), _end_ = (3); i <= _end_; i++) printf("%lld ", Ans[i]);
  puts("");
}
int main() {
  int t = read();
  while (t--) {
    init();
    doing();
  }
  return 0;
}
