#include <bits/stdc++.h>
using namespace std;
long long v[100005][3];
long long a, b, c, sum, dif, x, ansx, ansy, ansz;
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(long long x) {
  if (x < 0)
    return (x - 1) / 2;
  else
    return x / 2;
}
int main() {
  int tc;
  scanf("%d", &tc);
  while (tc--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
      scanf("%I64d%I64d%I64d", &v[i][0], &v[i][1], &v[i][2]);
    l = 0, r = inf;
    while (l <= r) {
      mid = (l + r) / 2;
      a1 = b1 = c1 = s1 = -inf;
      a2 = b2 = c2 = s2 = inf;
      for (int i = 1; i <= n; i++) {
        a1 = max(v[i][1] + v[i][2] - v[i][0] - mid, a1);
        a2 = min(v[i][1] + v[i][2] - v[i][0] + mid, a2);
        b1 = max(v[i][0] + v[i][2] - v[i][1] - mid, b1);
        b2 = min(v[i][0] + v[i][2] - v[i][1] + mid, b2);
        c1 = max(v[i][0] + v[i][1] - v[i][2] - mid, c1);
        c2 = min(v[i][0] + v[i][1] - v[i][2] + mid, c2);
        s1 = max(v[i][0] + v[i][1] + v[i][2] - mid, s1);
        s2 = min(v[i][0] + v[i][1] + v[i][2] + mid, s2);
      }
      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 (dif = max(x - b2, c1 - x); dif <= min(x - b1, c2 - x); dif++)
            if ((sum + dif) % 2 == 0) break;
          if (dif <= min(x - b1, c2 - x)) break;
        }
        if (sum <= min(a2 + x, s2 - x)) break;
      }
      if (x <= xmx) {
        ansx = x;
        ansy = div2(sum + dif);
        ansz = div2(sum - dif);
        r = mid - 1;
      } else
        l = mid + 1;
    }
    printf("%I64d %I64d %I64d\n", ansx, ansy, ansz);
  }
  return 0;
}
