#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
long long a[maxn], b[maxn];
bool cmp(long long a, long long b) { return a > b; }
int main(void) {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    for (long long i = 0; i <= n + 10; i++) a[i] = b[i] = 0;
    for (long long i = 1; i <= n; i++) {
      cin >> a[i];
      b[i] = a[i];
    }
    sort(a + 1, a + 1 + n);
    sort(b + 1, b + 1 + n, cmp);
    long long ans = -1e18;
    for (long long i = 0; i <= 5; i++) {
      long long j = 5 - i;
      long long sum = 1;
      for (long long k = 1; k <= i; k++) {
        sum *= a[k];
      }
      for (long long k = 1; k <= j; k++) {
        sum *= b[k];
      }
      ans = max(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}
