#include <bits/stdc++.h>
using namespace std;
const long long inf = 3e18;
int n;
long long ansa, ansb, ansc, x[100010], y[100010], z[100010], dl[4], dr[4], l[4],
    r[4];
inline long long read() {
  long long ans = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') f = ch == '-' ? -1 : f, ch = getchar();
  while (ch >= '0' && ch <= '9')
    ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
  return ans * f;
}
int check(long long num) {
  for (int i = 0; i < 4; i++) l[i] = -inf, r[i] = inf;
  for (int i = 1; i <= n; i++) {
    l[0] = max(l[0], x[i] + y[i] + z[i] - num);
    r[0] = min(r[0], x[i] + y[i] + z[i] + num);
    l[1] = max(l[1], -x[i] + y[i] + z[i] - num);
    r[1] = min(r[1], -x[i] + y[i] + z[i] + num);
    l[2] = max(l[2], x[i] - y[i] + z[i] - num);
    r[2] = min(r[2], x[i] - y[i] + z[i] + num);
    l[3] = max(l[3], x[i] + y[i] - z[i] - num);
    r[3] = min(r[3], x[i] + y[i] - z[i] + num);
  }
  for (int w = 0; w < 2; w++) {
    for (int i = 0; i < 4; i++)
      dl[i] = l[i] + ((l[i] & 1) ^ w), dr[i] = r[i] - ((r[i] & 1) ^ w);
    int flag = 1;
    for (int i = 0; i < 4; i++)
      if (dl[i] > dr[i]) flag = 0;
    if (!flag) continue;
    long long a = dl[1], b = dl[2], c = dl[3];
    if (a + b + c <= dr[0]) {
      if (a + b + c < dl[0]) {
        if (dr[1] > dl[0] - b - c)
          a = dl[0] - b - c;
        else
          a = dr[1];
      }
      if (a + b + c < dl[0]) {
        if (dr[2] > dl[0] - a - c)
          b = dl[0] - a - c;
        else
          b = dr[2];
      }
      if (a + b + c < dl[0]) {
        if (dr[3] > dl[0] - a - b)
          c = dl[0] - a - b;
        else
          c = dr[3];
      }
      if (a + b + c >= dl[0]) {
        ansa = (b + c) >> 1, ansb = (a + c) >> 1, ansc = (a + b) >> 1;
        return 1;
      }
    }
  }
  return 0;
}
int main() {
  int T = read();
  while (T--) {
    n = read();
    for (int i = 1; i <= n; i++) x[i] = read(), y[i] = read(), z[i] = read();
    long long l = 0, r = inf;
    while (l < r) {
      long long mid = (l + r) >> 1;
      if (check(mid))
        r = mid;
      else
        l = mid + 1;
    }
    check(r);
    printf("%lld %lld %lld\n", ansa, ansb, ansc);
  }
}
