#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 1000;
const long long mod = 1e9 + 7;
const long long hash_p1 = 1610612741;
const long long hash_p2 = 805306457;
const long long hash_p3 = 402653189;
struct elemt {
  long long x = 0;
  long long y = 0;
  long long z = 0;
};
long long n;
elemt a[2000100];
long long ansx = 0, ansy = 0, ansz = 0;
bool search(long long d) {
  long long l1 = -4e18, l2 = -4e18, l3 = -4e18, l4 = -4e18, r1 = 4e18,
            r2 = 4e18, r3 = 4e18, r4 = 4e18;
  for (long long i = 1; i <= n; i++) {
    l1 = max(l1, -d + a[i].x + a[i].y + a[i].z);
    r1 = min(r1, d + a[i].x + a[i].y + a[i].z);
    l2 = max(l2, -d - a[i].x + a[i].y + a[i].z);
    r2 = min(r2, d - a[i].x + a[i].y + a[i].z);
    l3 = max(l3, -d + a[i].x - a[i].y + a[i].z);
    r3 = min(r3, d + a[i].x - a[i].y + a[i].z);
    l4 = max(l4, -d + a[i].x + a[i].y - a[i].z);
    r4 = min(r4, d + a[i].x + a[i].y - a[i].z);
  }
  for (long long i = 0; i <= 1; i++) {
    long long l11 = l1 + ((l1 & 1) ^ i);
    long long r11 = r1 - ((r1 & 1) ^ i);
    long long l21 = l2 + ((l2 & 1) ^ i);
    long long r21 = r2 - ((r2 & 1) ^ i);
    long long l31 = l3 + ((l3 & 1) ^ i);
    long long r31 = r3 - ((r3 & 1) ^ i);
    long long l41 = l4 + ((l4 & 1) ^ i);
    long long r41 = r4 - ((r4 & 1) ^ i);
    if (l11 <= r11 && l21 <= r21 && l31 <= r31 && l41 <= r41) {
      long long a = l21;
      long long b = l31;
      long long c = l41;
      if (a + b + c <= r11) {
        if (a + b + c < l11) {
          if (r21 < l11 - b - c)
            a = r21;
          else
            a = l11 - b - c;
        }
        if (a + b + c < l11) {
          if (r31 < l11 - a - c)
            b = r31;
          else
            b = l11 - a - c;
        }
        if (a + b + c < l11) {
          if (r41 < l11 - a - b)
            c = r41;
          else
            c = l11 - a - b;
        }
        if (a + b + c >= l11) {
          ansx = (b + c) >> 1;
          ansy = (a + c) >> 1;
          ansz = (a + b) >> 1;
          return 1;
        }
      }
    }
  }
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> a[i].x >> a[i].y >> a[i].z;
    }
    long long l = 0, r = 4e18;
    while (l <= r) {
      long long mid = (l + r) / 2;
      if (search(mid)) {
        r = mid - 1;
      } else {
        l = mid + 1;
      }
    }
    cout << ansx << " " << ansy << " " << ansz << endl;
  }
  return 0;
}
