#include <bits/stdc++.h>
using namespace std;
const long long inf = 3 * 1e18;
long long mi[5], ma[5], low[5], high[5];
long long resx, resy, resz;
long long div2(long long x, long long y) {
  if (x > 0 && y > 0 || x < 0 && y < 0) {
    long long f = 0;
    if (x % 2 && y % 2) f = 1;
    if (x > 0 && y > 0)
      return x / 2 + y / 2 + f;
    else
      return x / 2 + y / 2 - f;
  } else
    return (x + y) / 2;
}
void update(long long s, long long d) {
  resy = div2(s, d);
  resz = div2(s, -d);
}
bool check(long long x) {
  for (int i = 1; i <= 4; i++) {
    low[i] = ma[i] - x;
    high[i] = mi[i] + x;
    if (low[i] > high[i]) return false;
  }
  long long x1 = div2(low[1], -high[2]);
  long long y1 = div2(high[1], -low[2]);
  long long x2 = div2(low[3], -high[4]);
  long long y2 = div2(high[3], -low[4]);
  long long x3 = max(x1, x2);
  long long y3 = min(y1, y2);
  if (x3 > y3) return false;
  for (long long i = x3; i <= y3; i++) {
    resx = i;
    long long s1 = max(low[1] - i, low[2] + i);
    long long s2 = min(high[1] - i, high[2] + i);
    long long d1 = max(low[3] - i, low[4] + i);
    long long d2 = min(high[3] - i, high[4] + i);
    if (s1 > s2 || d1 > d2) continue;
    if (s1 < s2) {
      if ((s1 & 1) == (d1 & 1))
        update(s1, d1);
      else
        update(s1 + 1, d1);
      return true;
    } else if (d1 < d2) {
      if ((s1 & 1) == (d1 & 1))
        update(s1, d1);
      else
        update(s1, d1 + 1);
      return true;
    } else {
      if ((s1 & 1) == (d1 & 1)) {
        update(s1, d1);
        return true;
      }
    }
  }
  return false;
}
int main() {
  int T;
  cin >> T;
  while (T--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= 4; i++) {
      mi[i] = inf;
      ma[i] = -inf;
    }
    for (int i = 0; i < n; i++) {
      long long x, y, z;
      scanf("%I64d%I64d%I64d", &x, &y, &z);
      mi[1] = min(mi[1], x + y + z);
      ma[1] = max(ma[1], x + y + z);
      mi[2] = min(mi[2], -x + y + z);
      ma[2] = max(ma[2], -x + y + z);
      mi[3] = min(mi[3], x + y - z);
      ma[3] = max(ma[3], x + y - z);
      mi[4] = min(mi[4], -x + y - z);
      ma[4] = max(ma[4], -x + y - z);
    }
    long long L = -1, R = inf;
    while (R - L > 1) {
      long long M = (L + R) >> 1;
      if (check(M))
        R = M;
      else
        L = M;
    }
    check(R);
    printf("%I64d %I64d %I64d\n", resx, resy, resz);
  }
  return 0;
}
