#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<ll> arr(n);
    bool has0 = false;
    for (int i = 0; i < n; ++i) {
      cin >> arr[i];
      if (!arr[i]) {
        has0 = true;
      }
    }
    sort(arr.begin(), arr.end());
    int lft = arr.size() - 5;
    ll sol = LLONG_MIN;
    for (int k = 1; k <= 6; ++k, ++lft) {
      ll val = 1LL;
      for (int j = lft; j <= lft + 4; ++j) {
        val = val * arr[j % n];
      }
      sol = max(sol, val);
    }
    if (has0) {
      sol = max(sol, 0LL);
    }
    cout << sol << "\n";
  }
  return 0;
}
