#include <bits/stdc++.h>
long long abc[4], xyz[4], min[4], max[4], min_[4], max_[4];
int valid() {
  double sum = (double)abc[1] + abc[2] + abc[3];
  if (sum < 0) sum = -sum;
  return sum <= 8e18;
}
int solve(int par) {
  for (int i = 1; i < 4; i++) {
    abc[i] = min_[i];
    if ((abc[i] % 2 != 0) != par) abc[i]++;
    if (abc[i] > max_[i]) return 0;
  }
  for (int i = 1; i < 4; i++)
    while (valid() && (abc[0] = abc[1] + abc[2] + abc[3]) < min_[0] &&
           abc[i] + 2 <= max_[i]) {
      long long d = (double)min_[0] - abc[0] < 1LL << 62
                        ? (min_[0] - abc[0] + 1) / 2 * 2
                        : 1LL << 62;
      long long a = (double)max_[i] - abc[i] < 1LL << 62
                        ? (max_[i] - abc[i]) / 2 * 2
                        : 1LL << 62;
      long long e = (d < a) ? d : a;
      abc[i] += e;
    }
  if (valid() && (abc[0] = abc[1] + abc[2] + abc[3]) <= max_[0])
    return abc[0] >= min_[0];
  return 0;
}
int parity(long long r) {
  for (int i = 0; i < 4; i++) {
    min_[i] = max[i] - r;
    max_[i] = min[i] + r;
    if (min_[i] > max_[i]) return 0;
  }
  if (solve(0)) {
    for (int i = 1; i < 4; i++) xyz[i] = abc[0] / 2 - abc[i] / 2;
    return 1;
  }
  if (solve(1)) {
    for (int i = 1; i < 4; i++) xyz[i] = (abc[0] + 1) / 2 - (abc[i] + 1) / 2;
    return 1;
  }
  return 0;
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    for (int k = 0; k < 4; k++) {
      min[k] = ((long long)8e18);
      max[k] = -((long long)8e18);
    }
    int n;
    scanf("%d", &n);
    for (int j = 0; j < n; j++) {
      long long x, y, z;
      scanf("%I64d %I64d %I64d", &x, &y, &z);
      abc[0] = x + y + z;
      abc[1] = -x + y + z;
      abc[2] = x - y + z;
      abc[3] = x + y - z;
      for (int k = 0; k < 4; k++) {
        if (min[k] > abc[k]) min[k] = abc[k];
        if (max[k] < abc[k]) max[k] = abc[k];
      }
    }
    long long lower = -1, upper = ((long long)3e18) + 1;
    while (upper - lower > 1) {
      long long r = (lower + upper) / 2;
      if (parity(r))
        upper = r;
      else
        lower = r;
    }
    printf("%I64d %I64d %I64d\n", xyz[1], xyz[2], xyz[3]);
  }
  return 0;
}
