#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 parity) {
  int i;
  for (i = 1; i < 4; i++) {
    abc[i] = min_[i];
    if ((abc[i] % 2 != 0) != parity) abc[i]++;
    if (abc[i] > max_[i]) return 0;
  }
  for (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 solve(long long r) {
  int i;
  for (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 (i = 1; i < 4; i++) xyz[i] = abc[0] / 2 - abc[i] / 2;
    return 1;
  }
  if (solve_(1)) {
    for (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);
  while (t-- > 0) {
    int i, n;
    long long lower, upper;
    scanf("%d", &n);
    for (i = 0; i < 4; i++)
      min[i] = ((long long)8e18), max[i] = -((long long)8e18);
    while (n-- > 0) {
      long long x, y, z;
      scanf("%lld%lld%lld", &x, &y, &z);
      abc[0] = x + y + z;
      abc[1] = -x + y + z;
      abc[2] = x + -y + z;
      abc[3] = x + y + -z;
      for (i = 0; i < 4; i++) {
        if (min[i] > abc[i]) min[i] = abc[i];
        if (max[i] < abc[i]) max[i] = abc[i];
      }
    }
    lower = -1, upper = ((long long)3e18) + 1;
    while (upper - lower > 1) {
      long long r = (lower + upper) / 2;
      if (solve(r))
        upper = r;
      else
        lower = r;
    }
    printf("%lld %lld %lld\n", xyz[1], xyz[2], xyz[3]);
  }
  return 0;
}
