#include <bits/stdc++.h>
using namespace std;
template <typename T>
T abs(T x) {
  return x > 0 ? x : -x;
}
template <typename T>
T sqr(T x) {
  return x * x;
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &x) {
  s << "[";
  for (auto it : x) {
    s << it << ", ";
  }
  s << "]";
  return s;
}
template <typename T>
ostream &operator<<(ostream &s, const set<T> &x) {
  s << "{";
  for (auto it : x) {
    s << it << ", ";
  }
  s << "}";
  return s;
}
template <typename U, typename V>
ostream &operator<<(ostream &s, const pair<U, V> &x) {
  s << "(" << x.first << ", " << x.second << ")";
  return s;
}
template <typename T>
bool chmax(T &x, const T &y) {
  if (x < y) {
    x = y;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T &x, const T &y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}
struct point {
  long long x, y, z;
  point(long long x, long long y, long long z) : x(x), y(y), z(z) {}
  point() {}
};
long long get_ans(long long x, long long y, long long z,
                  vector<point> &points) {
  long long ans = 0;
  for (auto p : points)
    ans = max(ans, abs(p.x - x) + abs(p.y - y) + abs(p.z - z));
  return ans;
}
const long long INF = 1e18;
long long norm(long long x) {
  if (x < -INF) return -INF;
  if (x > INF) return INF;
  return x;
}
bool check(long long c11, long long c12, long long c21, long long c22,
           long long c31, long long c32, long long c41, long long c42,
           long long v, long long &x, long long &y, long long &z) {
  z = v;
  c11 -= z;
  c12 -= z;
  c21 += z;
  c22 += z;
  c31 -= z;
  c32 -= z;
  c41 += z;
  c42 += z;
  if (c11 > c22) return false;
  if (c31 > c42) return false;
  if (c21 > c12) return false;
  if (c41 > c32) return false;
  long long xpymini = max(c11, c21), xpymaxi = min(c12, c22);
  long long xmymini = max(c31, c41), xmymaxi = min(c32, c42);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (xpymini + i <= xpymaxi && xmymini + j <= xmymaxi &&
          (xpymini + i + xmymini + j) % 2 == 0) {
        x = (xpymini + i + xmymini + j) / 2;
        y = xpymini + i - x;
        return true;
      }
  return false;
}
bool intersect(long long x1, long long y1, long long x2, long long y2) {
  return max(x1, x2) <= min(y1, y2);
}
bool check2(long long c11, long long c12, long long c21, long long c22,
            long long c31, long long c32, long long c41, long long c42,
            long long dop, long long &x, long long &y, long long &z) {
  c11 -= dop, c12 += dop, c21 -= dop, c22 += dop, c31 -= dop, c32 += dop,
      c41 -= dop, c42 += dop;
  long long delta1 = c11 - c22;
  if (delta1 & 1) delta1++;
  long long delta2 = c12 - c21;
  if (delta2 & 1) delta2--;
  delta1 /= 2, delta2 /= 2;
  long long delta3 = c31 - c42;
  if (delta3 & 1) delta3++;
  long long delta4 = c32 - c41;
  if (delta4 & 1) delta4--;
  delta3 /= 2, delta4 /= 2;
  if (!intersect(delta1, delta2, delta3, delta4)) return false;
  long long mini = max(delta1, delta3), maxi = min(delta2, delta4);
  for (int i = 0; i < 2; i++) {
    if (mini + i > maxi) break;
    if (check(c11, c12, c21, c22, c31, c32, c41, c42, mini + i, x, y, z)) {
      return true;
    }
  }
  return false;
}
point get_cans(long long c11, long long c12, long long c21, long long c22,
               long long c31, long long c32, long long c41, long long c42) {
  long long delta1 = c11 - c22;
  if (delta1 & 1) delta1++;
  long long delta2 = c12 - c21;
  if (delta2 & 1) delta2--;
  delta1 /= 2, delta2 /= 2;
  long long delta3 = c31 - c42;
  if (delta3 & 1) delta3++;
  long long delta4 = c32 - c41;
  if (delta4 & 1) delta4--;
  delta3 /= 2, delta4 /= 2;
  long long dop = 0;
  if (delta1 > delta2 || delta3 > delta4)
    delta1--, delta2++, delta3--, delta4++, dop++;
  if (intersect(delta1, delta2, delta3, delta4)) {
    dop = dop;
  } else if (delta2 < delta3)
    dop += (delta3 - delta2 + 1) / 2;
  else if (delta4 < delta1)
    dop += (delta1 - delta4 + 1) / 2;
  for (int i = 0; i < 2; i++) {
    long long x, y, z;
    if (check2(c11, c12, c21, c22, c31, c32, c41, c42, dop + i, x, y, z)) {
      return point(x, y, z);
    }
  }
  assert(false);
  return point(0, 0, 0);
}
void solve() {
  int n;
  scanf("%d", &n);
  vector<point> points(n);
  for (int i = 0; i < n; i++)
    scanf("%I64d %I64d %I64d", &points[i].x, &points[i].y, &points[i].z);
  vector<vector<long long> > d(4);
  for (int msk = 0; msk < 4; msk++) {
    for (auto p : points) {
      long long sum = p.x + p.y + p.z;
      if (msk & 2) sum -= 2 * p.y;
      if (msk & 1) sum -= 2 * p.z;
      d[msk].push_back(sum);
    }
  }
  long long maxi = 0;
  vector<long long> maxis(4), minis(4);
  for (int i = 0; i < 4; i++) {
    minis[i] = *min_element(d[i].begin(), d[i].end());
    maxis[i] = *max_element(d[i].begin(), d[i].end());
    maxi = max(maxi, (maxis[i] - minis[i] + 1) / 2);
  }
  point ans = get_cans(maxis[0] - maxi, minis[0] + maxi, maxis[1] - maxi,
                       minis[1] + maxi, maxis[2] - maxi, minis[2] + maxi,
                       maxis[3] - maxi, minis[3] + maxi);
  printf("%I64d %I64d %I64d\n", norm(ans.x), norm(ans.y), norm(ans.z));
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    solve();
  }
  return 0;
}
