#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
const long long INF = 4e18;
int T, n;
long long L1, L2, L3, L4, R1, R2, R3, R4;
long long x, y, z;
bool check(long long k) {
  for (int i = 0; i < 2; i++) {
    long long l1 = (L1 - k - 3 * i + 1) >> 1, l2 = (L2 - k - i + 1) >> 1,
              l3 = (L3 - k - i + 1) >> 1, l4 = (L4 - k - i + 1) >> 1;
    long long r1 = (R1 + k - 3 * i) >> 1, r2 = (R2 + k - i) >> 1,
              r3 = (R3 + k - i) >> 1, r4 = (R4 + k - i) >> 1;
    if (l1 <= r1 && l2 <= r2 && l3 <= r3 && l4 <= r4 && l2 + l3 + l4 <= r1 &&
        r2 + r3 + r4 >= l1) {
      long long a, b, c;
      if (l2 + l3 + l4 >= l1)
        a = l2, b = l3, c = l4;
      else if (r2 + l3 + l4 >= l1)
        a = l1 - l3 - l4, b = l3, c = l4;
      else if (r2 + r3 + l4 >= l1)
        a = r2, b = l1 - r2 - l4, c = l4;
      else
        a = r2, b = r3, c = l1 - r2 - r3;
      a = 2 * a | i, b = 2 * b | i, c = 2 * c | i;
      x = (b + c) >> 1, y = (a + c) >> 1, z = (a + b) >> 1;
      return 1;
    }
  }
  return 0;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    L1 = L2 = L3 = L4 = -INF, R1 = R2 = R3 = R4 = INF;
    for (int i = 1; i <= n; i++) {
      long long x, y, z;
      scanf("%lld%lld%lld", &x, &y, &z);
      L1 = max(L1, x + y + z), R1 = min(R1, x + y + z);
      L2 = max(L2, -x + y + z), R2 = min(R2, -x + y + z);
      L3 = max(L3, x - y + z), R3 = min(R3, x - y + z);
      L4 = max(L4, x + y - z), R4 = min(R4, x + y - z);
    }
    long long l = 0, r = INF;
    while (l < r) {
      long long mid = (l + r) / 2;
      if (check(mid))
        r = mid;
      else
        l = mid + 1;
    }
    check(l);
    printf("%lld %lld %lld\n", x, y, z);
  }
  return 0;
}
