#include <bits/stdc++.h>
using namespace std;
long long r, sum, lim[4], s[4], x[4], y[4], dist, a[3], d, tol;
int k[4][3] = {1, 1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1};
void func() {
  printf("%I64d %I64d %I64d\n", (s[1] + s[2]) / 2, (s[1] + s[3]) / 2,
         (s[2] + s[3]) / 2);
  return;
}
bool check(int k) {
  int i;
  for (i = 0; i < 4; i++) {
    s[i] = (x[i] - r) + ((x[i] - r + k) % 2 + 2) % 2;
    if (s[i] > y[i] + r) return 0;
  }
  sum = s[1] + s[2] + s[3];
  if (sum > y[0] + r) return 0;
  if (sum >= x[0] - r) return 1;
  for (i = 0; i < 4; i++) lim[i] = (y[i] + r) - ((y[i] + r + k) % 2 + 2) % 2;
  for (i = 1; i < 4; i++) {
    d = min(lim[i] - s[i], lim[0] - sum);
    sum += d;
    s[i] += d;
  }
  if (sum < x[0] - r) return 0;
  return 1;
}
int main() {
  int i, j, cnt, n;
  scanf("%d", &cnt);
  while (cnt--) {
    for (i = 0; i < 4; i++) {
      x[i] = -4 * 1e18;
      y[i] = 4 * 1e18;
    }
    dist = -4 * 1e18;
    scanf("%d", &n);
    while (n--) {
      scanf("%I64d %I64d %I64d", a + 0, a + 1, a + 2);
      for (i = 0; i < 4; i++) {
        tol = k[i][0] * a[0] + k[i][1] * a[1] + k[i][2] * a[2];
        if (tol > x[i]) x[i] = tol;
        if (tol < y[i]) y[i] = tol;
      }
    }
    for (i = 0; i < 4; i++) {
      if (dist < x[i] - y[i]) dist = x[i] - y[i];
    }
    tol = max(x[0] / 4 - y[1] / 4 - y[2] / 4 - y[3] / 4 - 5,
              x[1] / 4 + x[2] / 4 + x[3] / 4 - y[0] / 4 - 5);
    r = max(tol, (dist + 1) / 2);
    while (1) {
      if (check(1)) {
        func();
        break;
      } else if (check(0)) {
        func();
        break;
      } else
        r++;
    }
  }
}
