#include <bits/stdc++.h>
using namespace std;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
template <typename I, typename... T>
inline bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.16lf", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
inline void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << endl;
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) & 0x7fffffff;
}
const long long INF = INT64_MAX;
struct Equation {
  pair<long long, long long> s, a, b, c;
};
inline Equation operator+(const Equation &e1, const Equation &e2) {
  Equation x;
  x.s = make_pair(max(e1.s.first, e2.s.first), min(e1.s.second, e2.s.second));
  x.a = make_pair(max(e1.a.first, e2.a.first), min(e1.a.second, e2.a.second));
  x.b = make_pair(max(e1.b.first, e2.b.first), min(e1.b.second, e2.b.second));
  x.c = make_pair(max(e1.c.first, e2.c.first), min(e1.c.second, e2.c.second));
  return x;
}
inline tuple<long long, long long, long long> calc_pos(const Equation &e) {
  if (e.s.first > e.s.second) return make_tuple(INF, INF, INF);
  if (e.a.first > e.a.second) return make_tuple(INF, INF, INF);
  if (e.b.first > e.b.second) return make_tuple(INF, INF, INF);
  if (e.c.first > e.c.second) return make_tuple(INF, INF, INF);
  if (e.a.first + e.b.first + e.c.first > e.s.second)
    return make_tuple(INF, INF, INF);
  if (e.a.second + e.b.second + e.c.second < e.s.first)
    return make_tuple(INF, INF, INF);
  long long x = e.a.first;
  long long y = e.b.first;
  long long z = e.c.first;
  long long r = max(0LL, e.s.first - x - y - z);
  long long t = min(r, e.a.second - x);
  x += t, r -= t;
  t = min(r, e.b.second - y);
  y += t, r -= t;
  t = min(r, e.c.second - z);
  z += t, r -= t;
  return make_tuple(x, y, z);
}
vector<tuple<long long, long long, long long> > ps;
inline tuple<long long, long long, long long> calc_ans(const long long &k) {
  Equation e;
  e.s = make_pair(-INF, INF);
  e.a = make_pair(-INF, INF);
  e.b = make_pair(-INF, INF);
  e.c = make_pair(-INF, INF);
  for (tuple<long long, long long, long long> ob : ps) {
    long long x = get<0>(ob);
    long long y = get<1>(ob);
    long long z = get<2>(ob);
    Equation te;
    te.s = make_pair(x + y + z - k, x + y + z + k);
    te.a = make_pair(-x + y + z - k, -x + y + z + k);
    te.b = make_pair(x + y - z - k, x + y - z + k);
    te.c = make_pair(x - y + z - k, x - y + z + k);
    e = e + te;
  }
  for (int r = 0; r < int(2); r++) {
    Equation ne;
    ne.s.first = (e.s.first - 3LL * r + 1LL) >> 1LL;
    ne.a.first = (e.a.first - r + 1LL) >> 1LL;
    ne.b.first = (e.b.first - r + 1LL) >> 1LL;
    ne.c.first = (e.c.first - r + 1LL) >> 1LL;
    ne.s.second = (e.s.second - 3LL * r) >> 1LL;
    ne.a.second = (e.a.second - r) >> 1LL;
    ne.b.second = (e.b.second - r) >> 1LL;
    ne.c.second = (e.c.second - r) >> 1LL;
    tuple<long long, long long, long long> p = calc_pos(ne);
    long long ta = get<0>(p);
    long long tb = get<1>(p);
    long long tc = get<2>(p);
    if (ta == INF) continue;
    return make_tuple(tb + tc + r, ta + tb + r, ta + tc + r);
  }
  return make_tuple(INF, INF, INF);
}
int main() {
  int t;
  RI(t);
  while (t--) {
    int n;
    RI(n);
    ps.clear();
    for (int i = 0; i < int(n); i++) {
      long long x, y, z;
      RI(x, y, z);
      ps.push_back(make_tuple(x, y, z));
    }
    long long lb = 0LL, rb = 3 * 1000000000000000000LL + 10;
    while (lb < rb) {
      long long m = (lb + rb) >> 1LL;
      if (get<0>(calc_ans(m)) != INF)
        rb = m;
      else
        lb = m + 1LL;
    }
    tuple<long long, long long, long long> p = calc_ans(lb);
    PL(get<0>(p), get<1>(p), get<2>(p));
  }
  return 0;
}
