#include <bits/stdc++.h>
using namespace std;
int T, n;
long long ans1, ans2, ans3;
struct point {
  long long x, y, z;
} s[100005];
long long l[10][2];
bool check(long long x) {
  for (int i = 1; i <= 4; i++) l[i][0] = -3e18, l[i][1] = 3e18;
  for (int i = 1; i <= n; i++) {
    long long a = s[i].x, b = s[i].y, c = s[i].z;
    l[1][0] = max(l[1][0], a + b + c - x);
    l[1][1] = min(l[1][1], a + b + c + x);
    l[2][0] = max(l[2][0], a + b - c - x);
    l[2][1] = min(l[2][1], a + b - c + x);
    l[3][0] = max(l[3][0], a - b + c - x);
    l[3][1] = min(l[3][1], a - b + c + x);
    l[4][0] = max(l[4][0], -a + b + c - x);
    l[4][1] = min(l[4][1], -a + b + c + x);
  }
  for (int t = 0; t <= 1; t++) {
    long long a = l[2][0], b = l[3][0], c = l[4][0], d = l[1][0], A = l[2][1],
              B = l[3][1], C = l[4][1], D = l[1][1];
    if ((a & 1) != t) a++;
    if ((A & 1) != t) A--;
    if ((b & 1) != t) b++;
    if ((B & 1) != t) B--;
    if ((c & 1) != t) c++;
    if ((C & 1) != t) C--;
    if ((d & 1) != t) d++;
    if ((D & 1) != t) D--;
    if (a > A || b > B || c > C || d > D || a + b + c > D || A + B + C < d)
      continue;
    long long tmp = max(d - a - b - c, 0ll), ti;
    ti = min(tmp, A - a);
    tmp -= ti;
    a += ti;
    ti = min(tmp, B - b);
    tmp -= ti;
    b += ti;
    ti = min(tmp, C - c);
    tmp -= ti;
    c += ti;
    if (tmp != 0) continue;
    ans1 = (a + b) / 2;
    ans2 = (a + c) / 2;
    ans3 = (b + c) / 2;
    return 1;
  }
  return 0;
}
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
      scanf("%lld%lld%lld", &s[i].x, &s[i].y, &s[i].z);
    long long l = 0, r = 3e18;
    while (l + 1 < r) {
      long long mid = (l + r) / 2;
      if (check(mid))
        r = mid;
      else
        l = mid;
    }
    check(r);
    check(l);
    printf("%lld %lld %lld\n", ans1, ans2, ans3);
  }
  return 0;
}
