#include <bits/stdc++.h>
using namespace std;
class point {
 public:
  long long x, y, z;
  point(long long x, long long y, long long z) : x(x), y(y), z(z) {}
  point() {}
} arr[100010];
const long long inf = LONG_LONG_MAX;
const long long maxn = 3LL * 1000000000LL * 1000000000LL + 10;
class range {
 public:
  pair<long long, long long> s;
  pair<long long, long long> a, b, c;
  range() {
    s = a = b = c = pair<long long, long long>(LONG_LONG_MIN, LONG_LONG_MAX);
  }
  void add(range x) {
    s.first = max(s.first, x.s.first);
    s.second = min(s.second, x.s.second);
    a.first = max(a.first, x.a.first);
    a.second = min(a.second, x.a.second);
    b.first = max(b.first, x.b.first);
    b.second = min(b.second, x.b.second);
    c.first = max(c.first, x.c.first);
    c.second = min(c.second, x.c.second);
  }
  bool good() {
    return (s.first <= s.second) && (a.first <= a.second) &&
           (b.first <= b.second) && (c.first <= c.second);
  }
  void print() {
    cerr << a.first << " <= a <= " << a.second << endl;
    cerr << b.first << " <= b <= " << b.second << endl;
    cerr << c.first << " <= c <= " << c.second << endl;
    cerr << s.first << " <= s <= " << s.second << endl;
    cerr << endl;
  }
};
int n;
long long ceiling(long long x) { return (x + (x & 1)) / 2; }
long long floor(long long x) { return (x - (x & 1)) / 2; }
point solveIn(range x) {
  if (!x.good()) return point(inf, 0, 0);
  long long p = x.a.first;
  long long q = x.b.first;
  long long r = x.c.first;
  long long sum = p + q + r;
  if (sum > x.s.second) return point(inf, 0, 0);
  if (x.s.first <= sum) return point(p, q, r);
  long long diff = x.s.first - sum;
  if (r + diff <= x.c.second) {
    r += diff;
    diff = 0;
  } else {
    r = x.c.second;
    diff -= x.c.second - x.c.first;
  }
  if (q + diff <= x.b.second) {
    q += diff;
    diff = 0;
  } else {
    q = x.b.second;
    diff -= x.b.second - x.b.first;
  }
  if (p + diff <= x.a.second) {
    p += diff;
    diff = 0;
  } else {
    p = x.a.second;
    diff -= x.a.second - x.a.first;
  }
  if (diff == 0)
    return point(p, q, r);
  else
    return point(inf, 0, 0);
}
point solve(long long var) {
  range ans;
  for (int i = 1; i <= n; i++) {
    point p = arr[i];
    long long a = -p.x + p.y + p.z;
    long long b = p.x - p.y + p.z;
    long long c = p.x + p.y - p.z;
    long long s = p.x + p.y + p.z;
    range x;
    x.s = pair<long long, long long>(s - var, s + var);
    x.a = pair<long long, long long>(a - var, a + var);
    x.b = pair<long long, long long>(b - var, b + var);
    x.c = pair<long long, long long>(c - var, c + var);
    ans.add(x);
  }
  for (int r = 0; r <= 1; r++) {
    range d = ans;
    d.s.first = ceiling(d.s.first - 3 * r);
    d.a.first = ceiling(d.a.first - r);
    d.b.first = ceiling(d.b.first - r);
    d.c.first = ceiling(d.c.first - r);
    d.s.second = floor(d.s.second - 3 * r);
    d.a.second = floor(d.a.second - r);
    d.b.second = floor(d.b.second - r);
    d.c.second = floor(d.c.second - r);
    point sol = solveIn(d);
    if (sol.x == inf) continue;
    return point(sol.y + sol.z + r, sol.x + sol.z + r, sol.x + sol.y + r);
  }
  return point(inf, 0, 0);
}
inline void print(point a) { printf("%lld %lld %lld\n", a.x, a.y, a.z); }
long long search(long long b, long long e) {
  if (b == e) {
    return b;
  }
  long long m = (b + e) >> 1LL;
  point sol = solve(m);
  if (sol.x == inf)
    return search(m + 1, e);
  else
    return search(b, m);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
      long long p, q, r;
      scanf("%lld %lld %lld", &p, &q, &r);
      arr[i] = point(p, q, r);
    }
    long long opt = search(0, maxn);
    point ans = solve(opt);
    print(ans);
  }
  return 0;
}
