#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 2e9 + 10;
const long double EPS = 1e-9;
const int M = 1e2 + 12;
const int N = 4e5 + 10;
void solve() {
  int n = 250;
  vector<int> a(n);
  for (long long i = 0; i < n; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  int p = (accumulate(a.begin(), a.end(), 0ll) / n);
  long double m1 = (long double)p / 2.;
  long double m2 = (long double)p * (3. / 2.);
  int c1 = 0, c2 = 0, c3 = 0;
  for (long long i = 0; i < n; ++i)
    if (a[i] < m1)
      c1++;
    else if (a[i] > m2)
      c3++;
    else
      c2++;
  if (c2 <= 3 * (c1 + c3)) {
    cout << (a[0] + a[n - 1]) / 2 << endl;
  } else {
    cout << round(((long double)a[(n - 1) / 2] + (long double)a[n / 2]) / 2.)
         << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int v;
  cin >> v;
  while (v--) {
    solve();
  }
}
