#include <bits/stdc++.h>
using namespace std;
const int sz = 100010;
const long long inf = 3e18;
long long x[sz], y[sz], z[sz];
long long ans_x, ans_y, ans_z;
int n;
bool tru(long long r) {
  long long L[4], R[4];
  int k, i;
  for (k = 0; k < 4; k++) {
    L[k] = -inf;
    R[k] = inf;
  }
  for (k = 1; k <= n; k++) {
    L[0] = max(L[0], x[k] + y[k] + z[k] - r);
    R[0] = min(R[0], x[k] + y[k] + z[k] + r);
    L[1] = max(L[1], -x[k] + y[k] + z[k] - r);
    R[1] = min(R[1], -x[k] + y[k] + z[k] + r);
    L[2] = max(L[2], x[k] - y[k] + z[k] - r);
    R[2] = min(R[2], x[k] - y[k] + z[k] + r);
    L[3] = max(L[3], x[k] + y[k] - z[k] - r);
    R[3] = min(R[3], x[k] + y[k] - z[k] + r);
  }
  for (k = 0; k < 4; k++) {
    if (L[k] > R[k]) return false;
  }
  for (i = 0; i < 2; i++) {
    long long l[k], r[k];
    for (k = 0; k < 4; k++) {
      l[k] = L[k];
      r[k] = R[k];
    }
    for (k = 1; k < 4; k++) {
      if (abs(l[k]) % 2 != i) l[k]++;
      if (abs(r[k]) % 2 != i) r[k]--;
    }
    l[0] = max(l[0], l[1] + l[2] + l[3]);
    r[0] = min(r[0], r[1] + r[2] + r[3]);
    if (abs(l[0]) % 2 != i) l[0]++;
    if (abs(r[0]) % 2 != i) r[0]--;
    if (l[0] > r[0]) continue;
    if (l[1] > r[1]) continue;
    if (l[2] > r[2]) continue;
    if (l[3] > r[3]) continue;
    long long s1 = l[1], s2 = l[2], s3 = l[3];
    if (s1 + s2 + s3 < r[0]) {
      s1 = min(r[1], l[0] - s2 - s3);
    }
    if (s1 + s2 + s3 < r[0]) {
      s2 = min(r[2], l[0] - s1 - s3);
    }
    if (s1 + s2 + s3 < r[0]) {
      s3 = min(r[3], l[0] - s1 - s2);
    }
    if (s1 + s2 + s3 >= l[0] && s1 + s2 + s3 <= r[0]) {
      ans_x = (s2 + s3) / 2;
      ans_y = (s1 + s3) / 2;
      ans_z = (s1 + s2) / 2;
      return true;
    }
  }
  return false;
}
int main() {
  int T, k;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (k = 1; k <= n; k++) scanf("%I64d%I64d%I64d", &x[k], &y[k], &z[k]);
    long long L = 0, R = inf, M;
    while (L <= R) {
      M = (L + R) / 2;
      if (tru(M))
        R = M - 1;
      else
        L = M + 1;
    }
    tru(L);
    printf("%I64d %I64d %I64d\n", ans_x, ans_y, ans_z);
  }
}
