#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
  cout << "[";
  for (int i = 0; i < v.size(); i++) {
    if (i > 0) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tt;
  cin >> tt;
  while (tt--) {
    int n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a.begin(), a.end(), [&](int x, int y) { return abs(x) > abs(y); });
    if (*max_element(a.begin(), a.end()) < 0) {
      ll p = 1;
      for (int i = n - 1; i >= n - 5; i--) p *= a[i];
      cout << p << "\n";
      continue;
    }
    ll prod = 1;
    for (int i = 0; i < 5; i++) {
      prod *= a[i];
    }
    if (prod > 0) {
      cout << prod << "\n";
      continue;
    }
    for (int i = 5; i < n; i++) {
      for (int j = 0; j < 5; j++) {
        ll new_prod = a[i];
        for (int k = 0; k < 5; k++) {
          if (k != j) {
            new_prod *= a[k];
          }
        }
        prod = max(prod, new_prod);
      }
    }
    cout << prod << "\n";
  }
  return 0;
}
