#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
const int N = 1e5 + 10;
int n, a[N];
void solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  double left = a[1], sum = 0, right = 0;
  for (int i = 1; i <= n; ++i) {
    sum += a[i];
  }
  int l_cnt = 1, r_cnt = 0;
  for (int i = 2; i < n; ++i) {
    if ((left + a[i]) / i >= left / l_cnt) {
      l_cnt++;
      left += a[i];
    } else {
      break;
    }
  }
  r_cnt = n - l_cnt;
  right = (sum - left) / r_cnt;
  left /= l_cnt;
  printf("%lf\n", left + right);
}
int main() {
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
