#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long n;
struct xyz {
  long long x, y, z;
  xyz() {}
  xyz(long long x, long long y, long long z) : x(x), y(y), z(z) {}
} a[200000];
xyz ans;
int param(long long x) {
  long long i, j, k, l;
  pair<long long, long long> t1, t2, t3, t4;
  t1 = t2 = t3 = t4 = pair<long long, long long>(-0x3f3f3f3f3f3f3f3fll * 2,
                                                 0x3f3f3f3f3f3f3f3fll * 2);
  for (i = 0; i < n; i++) {
    long long s1, s2, s3, s4;
    s1 = a[i].x + a[i].y + a[i].z;
    s2 = a[i].x + a[i].y - a[i].z;
    s3 = a[i].x - a[i].y + a[i].z;
    s4 = a[i].x - a[i].y - a[i].z;
    t1.first = max(t1.first, s1 - x);
    t2.first = max(t2.first, s2 - x);
    t3.first = max(t3.first, s3 - x);
    t4.first = max(t4.first, s4 - x);
    t1.second = min(t1.second, s1 + x);
    t2.second = min(t2.second, s2 + x);
    t3.second = min(t3.second, s3 + x);
    t4.second = min(t4.second, s4 + x);
  }
  if (t1.first > t1.second || t2.first > t2.second || t3.first > t3.second ||
      t4.first > t4.second)
    return 0;
  long long dat[4][4] = {1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, 0};
  long long xu[4];
  pair<long long, long long> tdat[4] = {t1, t2, t3, t4};
  for (int jj = 0; jj < 2; jj++) {
    for (i = 0; i < 4; i++) {
      long long tar[3];
      long long tari = 0;
      for (j = 0; j < 4; j++)
        if (j != i) tar[tari++] = j;
      for (j = 0; j < 8; j++) {
        for (k = 0; k < 3; k++) {
          if ((1 << k) & j) {
            dat[tar[k]][3] = tdat[tar[k]].first;
            xu[tar[k]] = 1;
          } else {
            dat[tar[k]][3] = tdat[tar[k]].second;
            xu[tar[k]] = -1;
          }
        }
        for (k = 0; k < 3; k++) {
          if (abs(dat[tar[k]][3]) % 2 != jj) {
            dat[tar[k]][3] += xu[tar[k]];
          }
        }
        long long res[3] = {
            0,
        };
        for (k = 0; k < 3; k++) {
          for (l = k + 1; l < 3; l++) {
            long long dif = 0, difidx = -1;
            for (int ii = 0; ii < 3; ii++)
              dif += dat[tar[k]][ii] != dat[tar[l]][ii];
            if (dif == 2) continue;
            for (int ii = 0; ii < 3; ii++)
              if (dat[tar[k]][ii] != dat[tar[l]][ii]) difidx = ii;
            res[difidx] = (dat[tar[k]][3] - dat[tar[l]][3]) / 2;
          }
        }
        res[0] = dat[tar[0]][3];
        for (k = 1; k < 3; k++) res[0] -= dat[tar[0]][k] * res[k];
        int flag = 0;
        for (k = 0; k < 4; k++) {
          long long sum = 0;
          for (l = 0; l < 3; l++) sum += dat[k][l] * res[l];
          if (sum >= tdat[k].first && sum <= tdat[k].second)
            ;
          else
            break;
        }
        if (k == 4) {
          ans = xyz(res[0], res[1], res[2]);
          return 1;
        }
      }
    }
  }
  return 0;
}
int main() {
  long long i, j, k, l;
  long long T;
  cin >> T;
  while (T--) {
    scanf("%lld", &n);
    for (i = 0; i < n; i++) scanf("%lld%lld%lld", &a[i].x, &a[i].y, &a[i].z);
    long long low = 0, high = 0x3f3f3f3f3f3f3f3fll, mid;
    param(0);
    while (low <= high) {
      mid = (low + high) / 2;
      if (param(mid))
        high = mid - 1;
      else
        low = mid + 1;
    }
    param(low);
    printf("%lld %lld %lld\n", ans.x, ans.y, ans.z);
  }
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

When the river brought Gerda to the house of the Old Lady who Knew Magic, this lady decided to make Gerda her daughter. She wants Gerda to forget about Kay, so she puts all the roses from the garden underground.

Mole, who lives in this garden, now can watch the roses without going up to the surface. Typical mole is blind, but this mole was granted as special vision by the Old Lady. He can watch any underground objects on any distance, even through the obstacles and other objects. However, the quality of the picture depends on the Manhattan distance to object being observed.

Mole wants to find an optimal point to watch roses, that is such point with integer coordinates that the maximum Manhattan distance to the rose is minimum possible.

As usual, he asks you to help.

Manhattan distance between points (x1, y1, z1) and (x2, y2, z2) is defined as |x1 - x2| + |y1 - y2| + |z1 - z2|.

Input

The first line of the input contains an integer t t (1 ≤ t ≤ 100 000) — the number of test cases. Then follow exactly t blocks, each containing the description of exactly one test.

The first line of each block contains an integer ni (1 ≤ ni ≤ 100 000) — the number of roses in the test. Then follow ni lines, containing three integers each — the coordinates of the corresponding rose. Note that two or more roses may share the same position.

It's guaranteed that the sum of all ni doesn't exceed 100 000 and all coordinates are not greater than 1018 by their absolute value.

Output

For each of t test cases print three integers — the coordinates of the optimal point to watch roses. If there are many optimal answers, print any of them.

The coordinates of the optimal point may coincide with the coordinates of any rose.

Examples

Input

1
5
0 0 4
0 0 -4
0 4 0
4 0 0
1 1 1


Output

0 0 0


Input

2
1
3 5 9
2
3 5 9
3 5 9


Output

3 5 9
3 5 9

Note

In the first sample, the maximum Manhattan distance from the point to the rose is equal to 4.

In the second sample, the maximum possible distance is 0. Note that the positions of the roses may coincide with each other and with the position of the optimal point.

### Response

```cpp
#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long n;
struct xyz {
  long long x, y, z;
  xyz() {}
  xyz(long long x, long long y, long long z) : x(x), y(y), z(z) {}
} a[200000];
xyz ans;
int param(long long x) {
  long long i, j, k, l;
  pair<long long, long long> t1, t2, t3, t4;
  t1 = t2 = t3 = t4 = pair<long long, long long>(-0x3f3f3f3f3f3f3f3fll * 2,
                                                 0x3f3f3f3f3f3f3f3fll * 2);
  for (i = 0; i < n; i++) {
    long long s1, s2, s3, s4;
    s1 = a[i].x + a[i].y + a[i].z;
    s2 = a[i].x + a[i].y - a[i].z;
    s3 = a[i].x - a[i].y + a[i].z;
    s4 = a[i].x - a[i].y - a[i].z;
    t1.first = max(t1.first, s1 - x);
    t2.first = max(t2.first, s2 - x);
    t3.first = max(t3.first, s3 - x);
    t4.first = max(t4.first, s4 - x);
    t1.second = min(t1.second, s1 + x);
    t2.second = min(t2.second, s2 + x);
    t3.second = min(t3.second, s3 + x);
    t4.second = min(t4.second, s4 + x);
  }
  if (t1.first > t1.second || t2.first > t2.second || t3.first > t3.second ||
      t4.first > t4.second)
    return 0;
  long long dat[4][4] = {1, 1, 1, 0, 1, 1, -1, 0, 1, -1, 1, 0, 1, -1, -1, 0};
  long long xu[4];
  pair<long long, long long> tdat[4] = {t1, t2, t3, t4};
  for (int jj = 0; jj < 2; jj++) {
    for (i = 0; i < 4; i++) {
      long long tar[3];
      long long tari = 0;
      for (j = 0; j < 4; j++)
        if (j != i) tar[tari++] = j;
      for (j = 0; j < 8; j++) {
        for (k = 0; k < 3; k++) {
          if ((1 << k) & j) {
            dat[tar[k]][3] = tdat[tar[k]].first;
            xu[tar[k]] = 1;
          } else {
            dat[tar[k]][3] = tdat[tar[k]].second;
            xu[tar[k]] = -1;
          }
        }
        for (k = 0; k < 3; k++) {
          if (abs(dat[tar[k]][3]) % 2 != jj) {
            dat[tar[k]][3] += xu[tar[k]];
          }
        }
        long long res[3] = {
            0,
        };
        for (k = 0; k < 3; k++) {
          for (l = k + 1; l < 3; l++) {
            long long dif = 0, difidx = -1;
            for (int ii = 0; ii < 3; ii++)
              dif += dat[tar[k]][ii] != dat[tar[l]][ii];
            if (dif == 2) continue;
            for (int ii = 0; ii < 3; ii++)
              if (dat[tar[k]][ii] != dat[tar[l]][ii]) difidx = ii;
            res[difidx] = (dat[tar[k]][3] - dat[tar[l]][3]) / 2;
          }
        }
        res[0] = dat[tar[0]][3];
        for (k = 1; k < 3; k++) res[0] -= dat[tar[0]][k] * res[k];
        int flag = 0;
        for (k = 0; k < 4; k++) {
          long long sum = 0;
          for (l = 0; l < 3; l++) sum += dat[k][l] * res[l];
          if (sum >= tdat[k].first && sum <= tdat[k].second)
            ;
          else
            break;
        }
        if (k == 4) {
          ans = xyz(res[0], res[1], res[2]);
          return 1;
        }
      }
    }
  }
  return 0;
}
int main() {
  long long i, j, k, l;
  long long T;
  cin >> T;
  while (T--) {
    scanf("%lld", &n);
    for (i = 0; i < n; i++) scanf("%lld%lld%lld", &a[i].x, &a[i].y, &a[i].z);
    long long low = 0, high = 0x3f3f3f3f3f3f3f3fll, mid;
    param(0);
    while (low <= high) {
      mid = (low + high) / 2;
      if (param(mid))
        high = mid - 1;
      else
        low = mid + 1;
    }
    param(low);
    printf("%lld %lld %lld\n", ans.x, ans.y, ans.z);
  }
  return 0;
}

```