#include <bits/stdc++.h>
struct {
  inline operator int() {
    int x;
    return scanf("%d", &x), x;
  }
  inline operator long long() {
    long long x;
    return scanf("%lld", &x), x;
  }
  inline operator char() {
    char x[3];
    return scanf("%s", x), *x;
  }
} read;
const int maxn = 100005;
const long long lim = 3000000000000000000;
long long pos[4][maxn];
long long L[4], R[4];
long long get[4];
bool check(long long r, int n) {
  for (int k = 0; k < 4; k++) {
    L[k] = -lim * 2;
    R[k] = lim * 2;
    for (int i = 1; i <= n; i++) {
      L[k] = std::max(L[k], pos[k][i] - r);
      R[k] = std::min(R[k], pos[k][i] + r);
    }
  }
  for (int o = 0; o < 2; o++) {
    long long Lo[4], Ro[4];
    for (int k = 0; k < 4; k++) {
      Lo[k] = (L[k] & 1) == o ? L[k] : L[k] + 1;
      Ro[k] = (R[k] & 1) == o ? R[k] : R[k] - 1;
      if (Lo[k] > Ro[k]) goto FAIL;
      get[k] = Lo[k];
    }
    if ((get[1] + get[2] + get[3]) > Ro[0]) goto FAIL;
    for (int k = 3; k; k--)
      if ((get[1] + get[2] + get[3]) < Lo[0]) {
        if ((get[1] + get[2] + get[3]) - get[k] + Ro[k] <= Lo[0])
          get[k] = Ro[k];
        else
          get[k] = Lo[0] + get[k] - (get[1] + get[2] + get[3]);
      }
    if ((get[1] + get[2] + get[3]) < Lo[0]) goto FAIL;
    return 1;
  FAIL:;
  }
  return 0;
}
int main() {
  int T = read;
  while (T--) {
    int n = read;
    for (int i = 1; i <= n; i++) {
      long long x = read, y = read, z = read;
      pos[0][i] = x + y + z;
      pos[1][i] = x + y - z;
      pos[2][i] = x - y + z;
      pos[3][i] = -x + y + z;
    }
    long long l = 0, r = lim;
    while (l < r) {
      long long mid = (l + r) >> 1;
      if (check(mid, n))
        r = mid;
      else
        l = mid + 1;
    }
    check(l, n);
    long long x, y, z;
    printf("%lld %lld %lld\n", x = (get[1] + get[2]) >> 1,
           y = (get[1] + get[3]) >> 1, z = (get[2] + get[3]) >> 1);
  }
}
