#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
class solve {
  long long n, l, k, a, b, c, m, r;
  vector<long long> v;

 public:
  solve() {
    v.resize(250);
    for (auto &x : v) cin >> x;
    ;
    n = 250;
    a = -1, b = 1e9;
    for (int i = 0; i < 250; i++) {
      a = max(v[i], a);
      b = min(v[i], b);
    }
    double mean = accumulate(v.begin(), v.end(), 0) / 250.0, var = 0;
    for (int i = 0; i < 250; i++) {
      var += (v[i] - mean) * (v[i] - mean);
    }
    var /= 250;
    double Pm = mean, Pv = mean, Umean = (a + b) / 2,
           Uvar = ((a - b) * (a - b)) / 12.0;
    if (abs(Pv - var) < abs(Uvar - var)) {
      cout << int(mean) << endl;
    } else {
      cout << (int)((a - b - 1) / 2.0) << endl;
    }
  }
};
int main() {
  int t = 1;
  scanf("%d", &t);
  while (t--) new solve;
  return 0;
};
