#include <bits/stdc++.h>
using namespace std;
long long a[100010];
int32_t main() {
  long long T;
  cin >> T;
  while (T--) {
    long long n;
    cin >> n;
    for (long long i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + 1 + n);
    long long res = -(1ll << 62 - 1);
    for (long long i = 0; i <= 5; i++) {
      long long ans = 1;
      for (long long j = 1; j <= i; j++) {
        ans *= a[j];
      }
      for (long long j = n; j >= n - 4 + i; j--) {
        ans *= a[j];
      }
      res = max(res, ans);
    }
    cout << res << endl;
  }
  return 0;
}
