#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
bool compare(pair<int, int>& p1, pair<int, int>& p2) {
  return p1.second < p2.second;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    long long ans = LLONG_MIN;
    ans = max(ans, v[n - 1] * v[n - 2] * v[n - 3] * v[n - 4] * v[n - 5]);
    ans = max(ans, v[n - 1] * v[n - 2] * v[n - 3] * v[0] * v[1]);
    ans = max(ans, v[n - 1] * v[2] * v[3] * v[0] * v[1]);
    cout << ans << "\n";
  }
}
