#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) { return a > b ? a : b; }
long long a[100005];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
    }
    sort(a + 1, a + 1 + n);
    long long ans = a[n] * a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4];
    long long ans1 = a[n] * a[n - 1] * a[n - 2] * a[1] * a[2];
    long long ans2 = a[n] * a[1] * a[2] * a[3] * a[4];
    cout << max(max(ans, ans1), ans2) << endl;
  }
}
