#include <bits/stdc++.h>
using namespace std;
int T;
int a[300100];
int main() {
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    long long sum = 0;
    for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
    sort(a + 1, a + n + 1);
    double ans = -1e18;
    long long now = 0;
    for (int i = n; i > 1; i--) {
      now += a[i];
      ans = max(ans, now * 1.0 / (n - i + 1) + (sum - now) * 1.0 / (i - 1));
    }
    printf("%0.8lf\n", ans);
  }
  return 0;
}
