#include <bits/stdc++.h>
using namespace std;
long long int X, Y, Z;
bool run(vector<long long int> &x, vector<long long int> &y,
         vector<long long int> &z, long long int mid) {
  long long int bound[4][2];
  long long int t0 = x[0] + y[0] + z[0];
  long long int t1 = -x[0] + y[0] + z[0];
  long long int t2 = x[0] - y[0] + z[0];
  long long int t3 = x[0] + y[0] - z[0];
  bound[0][0] = t0 - mid;
  bound[0][1] = t0 + mid;
  bound[1][0] = t1 - mid;
  bound[1][1] = t1 + mid;
  bound[2][0] = t2 - mid;
  bound[2][1] = t2 + mid;
  bound[3][0] = t3 - mid;
  bound[3][1] = t3 + mid;
  for (int i = 1; i < x.size(); i++) {
    long long int t0 = x[i] + y[i] + z[i];
    long long int t1 = -x[i] + y[i] + z[i];
    long long int t2 = x[i] - y[i] + z[i];
    long long int t3 = x[i] + y[i] - z[i];
    bound[0][0] = max(t0 - mid, bound[0][0]);
    bound[0][1] = min(t0 + mid, bound[0][1]);
    bound[1][0] = max(t1 - mid, bound[1][0]);
    bound[1][1] = min(t1 + mid, bound[1][1]);
    bound[2][0] = max(t2 - mid, bound[2][0]);
    bound[2][1] = min(t2 + mid, bound[2][1]);
    bound[3][0] = max(t3 - mid, bound[3][0]);
    bound[3][1] = min(t3 + mid, bound[3][1]);
  }
  bool bad = false;
  for (int j = 0; j < 4; j++) {
    if (bound[j][0] > bound[j][1]) {
      bad = true;
    }
  }
  if (bad) return false;
  for (int parity = 0; parity < 2; parity++) {
    bool ans = false;
    long long int b[4][2];
    b[0][0] = (bound[0][0] - 3 * parity);
    b[0][1] = (bound[0][1] - 3 * parity);
    if (b[0][0] & 1) b[0][0]++;
    if (b[0][1] & 1) b[0][1]--;
    b[1][0] = (bound[1][0] - parity);
    b[1][1] = (bound[1][1] - parity);
    if (b[1][0] & 1) b[1][0]++;
    if (b[1][1] & 1) b[1][1]--;
    b[2][0] = (bound[2][0] - parity);
    b[2][1] = (bound[2][1] - parity);
    if ((b[2][0] & 1)) b[2][0]++;
    if ((b[2][1] & 1)) b[2][1]--;
    b[3][0] = (bound[3][0] - parity);
    b[3][1] = (bound[3][1] - parity);
    if (b[3][0] & 1) b[3][0]++;
    if (b[3][1] & 1) b[3][1]--;
    bool bad = false;
    for (int j = 0; j < 4; j++) {
      if (b[j][0] > b[j][1]) {
        bad = true;
      }
    }
    if (bad) continue;
    long long int initVal = b[1][0] + b[2][0] + b[3][0];
    long long int val[4] = {0, b[1][0], b[2][0], b[3][0]};
    if (initVal > b[0][1]) {
      continue;
    } else if (initVal < b[0][0]) {
      long long int needed = b[0][0] - initVal;
      if ((b[1][1] - val[1]) >= needed) {
        val[1] += needed;
        needed = 0;
      } else {
        needed -= (b[1][1] - val[1]);
        val[1] += (b[1][1] - val[1]);
      }
      if ((b[2][1] - val[2]) >= needed) {
        val[2] += needed;
        needed = 0;
      } else {
        needed -= (b[2][1] - val[2]);
        val[2] += (b[2][1] - val[2]);
      }
      if ((b[3][1] - val[3]) >= needed) {
        val[3] += needed;
        needed = 0;
      } else {
        needed -= (b[3][1] - val[3]);
        val[3] += (b[3][1] - val[3]);
      }
      if (needed <= 0) {
        ans = true;
      }
    } else {
      ans = true;
    }
    if (ans) {
      long long int A = (val[1]) + parity;
      long long int B = (val[2]) + parity;
      long long int C = (val[3]) + parity;
      assert(((B + C)) % 2 == 0 && ((A + C)) % 2 == 0 && ((B + A)) % 2 == 0);
      X = (B + C) / 2;
      Y = (A + C) / 2;
      Z = (A + B) / 2;
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<long long int> x(n), y(n), z(n);
    for (int i = 0; i < n; i++) {
      cin >> x[i] >> y[i] >> z[i];
    }
    long long int L = 0, R = 3e18;
    long long int ax, ay, az;
    ax = ay = az = -1e18;
    while (L <= R) {
      long long int mid = (L + R) >> 1;
      if (run(x, y, z, mid)) {
        R = mid - 1;
        ax = X, ay = Y, az = Z;
      } else {
        L = mid + 1;
      }
    }
    long long int actAns = -9e18;
    long long int xt = 185097714347307042;
    long long int yt = 169326667661285082;
    long long int zt = 370218498415077464;
    cout << ax << " " << ay << " " << az << endl;
  }
  return 0;
}
