#include <bits/stdc++.h>
using namespace std;
struct second {
  long long int x, y, z;
} s[100004];
long long int ax, ay, az;
int n;
int check(long long int d) {
  long long int s0, s1, s2, s3;
  long long int mn0, mn1, mn2, mn3, mx0, mx1, mx2, mx3;
  long long int mn_0, mn_1, mn_2, mn_3, mx_0, mx_1, mx_2, mx_3;
  int i = 0;
  mx_0 = s[i].x + s[i].y + s[i].z + d;
  mn_0 = s[i].x + s[i].y + s[i].z - d;
  mx_1 = -s[i].x + s[i].y + s[i].z + d;
  mn_1 = -s[i].x + s[i].y + s[i].z - d;
  mx_2 = s[i].x - s[i].y + s[i].z + d;
  mn_2 = s[i].x - s[i].y + s[i].z - d;
  mx_3 = s[i].x + s[i].y - s[i].z + d;
  mn_3 = s[i].x + s[i].y - s[i].z - d;
  for (i = 1; i < n; i++) {
    mx_0 = min(mx_0, s[i].x + s[i].y + s[i].z + d);
    mn_0 = max(mn_0, s[i].x + s[i].y + s[i].z - d);
    mx_1 = min(mx_1, -s[i].x + s[i].y + s[i].z + d);
    mn_1 = max(mn_1, -s[i].x + s[i].y + s[i].z - d);
    mx_2 = min(mx_2, s[i].x - s[i].y + s[i].z + d);
    mn_2 = max(mn_2, s[i].x - s[i].y + s[i].z - d);
    mx_3 = min(mx_3, s[i].x + s[i].y - s[i].z + d);
    mn_3 = max(mn_3, s[i].x + s[i].y - s[i].z - d);
  }
  for (i = 0; i < 2; i++) {
    mx0 = mx_0, mn0 = mn_0, mx1 = mx_1, mn1 = mn_1, mx2 = mx_2, mn2 = mn_2,
    mx3 = mx_3, mn3 = mn_3;
    if (abs(mx1 % 2) != i) mx1--;
    if (abs(mn1 % 2) != i) mn1++;
    if (abs(mx2 % 2) != i) mx2--;
    if (abs(mn2 % 2) != i) mn2++;
    if (abs(mx3 % 2) != i) mx3--;
    if (abs(mn3 % 2) != i) mn3++;
    mx0 = min(mx0, mx1 + mx2 + mx3);
    mn0 = max(mn0, mn1 + mn2 + mn3);
    if (abs(mx0 % 2) != i) mx0--;
    if (abs(mn0 % 2) != i) mn0++;
    if (mn1 + mn2 + mn3 > mx0 || mx1 + mx2 + mx3 < mn0) continue;
    if (mn1 > mx1 || mn2 > mx2 || mn3 > mx3 || mn0 > mx0) continue;
    s1 = mn1, s2 = mn2, s3 = mn3;
    if (s1 + s2 + s3 < mn0) {
      s1 = min(mx1, mn0 - s2 - s3);
    }
    if (s1 + s2 + s3 < mn0) {
      s2 = min(mx2, mn0 - s1 - s3);
    }
    if (s1 + s2 + s3 < mn0) {
      s3 = min(mx3, mn0 - s1 - s2);
    }
    if (s1 + s2 + s3 >= mn0 && s1 + s2 + s3 <= mx0) {
      ax = (s2 + s3) / 2;
      ay = (s1 + s3) / 2;
      az = (s1 + s2) / 2;
      return 1;
    }
  }
  return 0;
}
int main(void) {
  int t;
  scanf("%d", &t);
  for (; t > 0; t--) {
    scanf("%d", &n);
    int i;
    for (i = 0; i < n; i++) scanf("%lld%lld%lld", &s[i].x, &s[i].y, &s[i].z);
    long long int l = 0, r = 4000000000000000000;
    while (l <= r) {
      long long int mid = (l + r) / 2;
      if (check(mid))
        r = mid - 1;
      else
        l = mid + 1;
    }
    check(l);
    printf("%lld %lld %lld\n", ax, ay, az);
  }
  return 0;
}
