#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long x, y, z;
  Point(long long x, long long y, long long z) : x(x), y(y), z(z) {}
};
bool operator==(Point const &a, Point const &b) {
  return a.x == b.x && a.y == b.y && a.z == b.z;
}
bool operator!=(Point const &a, Point const &b) {
  return a.x != b.x || a.y != b.y || a.z != b.z;
}
long long const INFL = 4e18 + 100;
Point const NONE(INFL, INFL, INFL);
long long set_par(long long x, int par, int delta) {
  if (abs(x) % 2 != par) x += delta;
  return x;
}
struct Bounds {
  long long mi1, ma1, mi2, ma2, mi3, ma3, mi4, ma4;
  Bounds()
      : mi1(-INFL),
        ma1(INFL),
        mi2(-INFL),
        ma2(INFL),
        mi3(-INFL),
        ma3(INFL),
        mi4(-INFL),
        ma4(INFL) {}
  Bounds(Point p, long long sum)
      : mi1(p.x + p.y + p.z - sum),
        ma1(p.x + p.y + p.z + sum),
        mi2(-p.x + p.y + p.z - sum),
        ma2(-p.x + p.y + p.z + sum),
        mi3(p.x - p.y + p.z - sum),
        ma3(p.x - p.y + p.z + sum),
        mi4(p.x + p.y - p.z - sum),
        ma4(p.x + p.y - p.z + sum) {}
  void inter(Bounds const &bs) {
    mi1 = max(mi1, bs.mi1), ma1 = min(ma1, bs.ma1);
    mi2 = max(mi2, bs.mi2), ma2 = min(ma2, bs.ma2);
    mi3 = max(mi3, bs.mi3), ma3 = min(ma3, bs.ma3);
    mi4 = max(mi4, bs.mi4), ma4 = min(ma4, bs.ma4);
  }
  explicit operator Point() {
    for (int par = 0; par < 2; ++par) {
      long long a1 = set_par(mi2, par, 1), b1 = set_par(mi3, par, 1),
                c1 = set_par(mi4, par, 1);
      long long a2 = set_par(ma2, par, -1), b2 = set_par(ma3, par, -1),
                c2 = set_par(ma4, par, -1);
      if (a1 <= a2 && b1 <= b2 && c1 <= c2) {
        long long a = a1, b = b1, c = c1;
        if (a + b + c < mi1) {
          a = set_par(min(a2, mi1 - b - c), par, 1);
          if (a > a2) a = a1;
        }
        if (a + b + c < mi1) {
          b = set_par(min(b2, mi1 - a - c), par, 1);
          if (b > b2) b = b1;
        }
        if (a + b + c < mi1) {
          c = set_par(min(c2, mi1 - a - b), par, 1);
          if (c > c2) c = c1;
        }
        if (a + b + c >= mi1 && a + b + c <= ma1) {
          return Point((b + c) / 2, (a + c) / 2, (a + b) / 2);
        }
      }
    }
    return NONE;
  }
};
Point solve(vector<Point> const &ps, long long sum) {
  Bounds bounds;
  for (Point p : ps) bounds.inter(Bounds(p, sum));
  return (Point)bounds;
}
void solve() {
  int n;
  scanf("%d", &n);
  vector<Point> ps;
  for (int i = 0; i < n; ++i) {
    long long x, y, z;
    scanf("%I64d%I64d%I64d", &x, &y, &z);
    ps.emplace_back(x, y, z);
  }
  long long l = -1, r = INFL;
  while (r - l > 1) {
    long long m = (l + r) / 2;
    Point cur = solve(ps, m);
    (cur == NONE ? l : r) = m;
  }
  Point ans = solve(ps, r);
  cout << ans.x << ' ' << ans.y << ' ' << ans.z << '\n';
}
int main() {
  int tests;
  scanf("%d", &tests);
  while (tests--) solve();
}
