#include <bits/stdc++.h>
const int maxn = 100010;
const int coor[4] = {1, 2, 0, -1};
long long P[maxn + 1][3];
long long lower[4], upper[4];
bool first[4];
int n;
long long X, Y, Z;
void init() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; ++i)
    for (j = 0; j < 3; ++j) scanf("%I64d", &P[i][j]);
}
bool ky(long long C, long long r) {
  int i, j, k;
  long long s, t;
  first[0] = first[1] = first[2] = first[3] = true;
  for (i = 1; i <= n; ++i) {
    for (j = 0; j < 4; ++j) {
      s = 0;
      for (k = 0; k < 3; ++k) {
        if (coor[j] == k)
          s -= P[i][k];
        else
          s += P[i][k];
      }
      if (j != 3) {
        t = (s - C - r) / 2;
        while (t + t < s - C - r) ++t;
      } else {
        t = (s - C - 3 * r) / 2;
        while (t + t < s - C - 3 * r) ++t;
      }
      if (first[j] || t > lower[j]) lower[j] = t;
      if (j != 3) {
        t = (s + C - r) / 2;
        while (t + t > s + C - r) --t;
      } else {
        t = (s + C - 3 * r) / 2;
        while (t + t > s + C - 3 * r) --t;
      }
      if (first[j] || t < upper[j]) upper[j] = t;
      first[j] = false;
      if (lower[j] > upper[j]) return false;
    }
  }
  if (lower[0] + lower[1] + lower[2] > upper[3]) return false;
  if (upper[0] + upper[1] + upper[2] < lower[3]) return false;
  for (i = 0; i < 3; ++i) {
    if (lower[0] + lower[1] + lower[2] >= lower[3]) break;
    t = lower[3] - (lower[0] + lower[1] + lower[2]);
    if (t <= upper[i] - lower[i]) {
      lower[i] += t;
      break;
    }
    lower[i] = upper[i];
  }
  X = lower[0] + lower[1] + r;
  Y = lower[1] + lower[2] + r;
  Z = lower[2] + lower[0] + r;
  return true;
}
void work() {
  long long start, stop, mid;
  start = 0;
  stop = 7e18;
  while (start <= stop) {
    mid = (start + stop) / 2;
    if (ky(mid, 0))
      stop = mid - 1;
    else if (ky(mid, 1))
      stop = mid - 1;
    else
      start = mid + 1;
  }
}
void output() { printf("%I64d %I64d %I64d\n", X, Y, Z); }
int main() {
  int t, T;
  scanf("%d", &T);
  for (t = 1; t <= T; ++t) {
    init();
    work();
    output();
  }
  return 0;
}
