#include <bits/stdc++.h>
using namespace std;
long long xyz[100005][3];
long long a, b, c, sum, diff, x, ansx, ansy, ansz;
long long a1, a2, b1, b2, c1, c2, s1, s2;
long long A1, A2, B1, B2, C1, C2, S1, S2;
long long l, r, mid;
int n;
const long long INF = (1LL << 62);
long long div2(const long long& x) {
  if (x < 0)
    return (x - 1) / 2;
  else
    return x / 2;
}
void solve() {
  A1 = B1 = C1 = S1 = -INF;
  A2 = B2 = C2 = S2 = INF;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld%lld", &xyz[i][0], &xyz[i][1], &xyz[i][2]);
    A1 = max(xyz[i][1] + xyz[i][2] - xyz[i][0], A1);
    A2 = min(xyz[i][1] + xyz[i][2] - xyz[i][0], A2);
    B1 = max(xyz[i][0] + xyz[i][2] - xyz[i][1], B1);
    B2 = min(xyz[i][0] + xyz[i][2] - xyz[i][1], B2);
    C1 = max(xyz[i][0] + xyz[i][1] - xyz[i][2], C1);
    C2 = min(xyz[i][0] + xyz[i][1] - xyz[i][2], C2);
    S1 = max(xyz[i][0] + xyz[i][1] + xyz[i][2], S1);
    S2 = min(xyz[i][0] + xyz[i][1] + xyz[i][2], S2);
  }
  l = 0, r = INF;
  while (l <= r) {
    mid = (l + r) / 2;
    a1 = A1 - mid;
    a2 = A2 + mid;
    b1 = B1 - mid;
    b2 = B2 + mid;
    c1 = C1 - mid;
    c2 = C2 + mid;
    s1 = S1 - mid;
    s2 = S2 + mid;
    if (a1 > a2 || b1 > b2 || c1 > c2 || s1 > s2) {
      l = mid + 1;
      continue;
    }
    long long xmn = max(div2(s1 - a2 + 1), div2(b1 + c1 + 1));
    long long xmx = min(div2(s2 - a1), div2(b2 + c2));
    for (x = xmn; x <= xmx; x++) {
      for (sum = max(a1 + x, s1 - x); sum <= min(a2 + x, s2 - x); ++sum) {
        for (diff = max(x - b2, c1 - x); diff <= min(x - b1, c2 - x); ++diff)
          if ((sum + diff) % 2 == 0) break;
        if (diff <= min(x - b1, c2 - x)) break;
      }
      if (sum <= min(a2 + x, s2 - x)) break;
    }
    if (x <= xmx) {
      ansx = x;
      ansy = (sum + diff) / 2;
      ansz = (sum - diff) / 2;
      r = mid - 1;
    } else
      l = mid + 1;
  }
  printf("%lld %lld %lld\n", ansx, ansy, ansz);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) solve();
}
