#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    vector<long long int> a(n);
    for (long long int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    long long int ans1 = 0, ans2 = 0, ans3 = 0, ans4 = 0, ans5 = 0, ans6 = 0;
    ans1 = a[0] * a[1] * a[2] * a[3] * a[4];
    ans2 = a[0] * a[1] * a[2] * a[3] * a[n - 1];
    ans3 = a[0] * a[1] * a[2] * a[n - 2] * a[n - 1];
    ans4 = a[0] * a[1] * a[n - 3] * a[n - 2] * a[n - 1];
    ans5 = a[0] * a[n - 4] * a[n - 3] * a[n - 2] * a[n - 1];
    ans6 = a[n - 5] * a[n - 4] * a[n - 3] * a[n - 2] * a[n - 1];
    cout << max({ans1, ans2, ans3, ans4, ans5, ans6}) << endl;
  }
  return 0;
}
