#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<ll> v(n);
    for (int i = (int)0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    ll ans = -1e18;
    for (int i = n - 5; i < n; i++) {
      ll count = 1;
      int k = i;
      for (int j = (int)0; j < 5; j++) {
        count *= v[k % n];
        k++;
      }
      ans = max(ans, count);
    }
    cout << ans << '\n';
  }
  return 0;
}
