#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    long long x, y, z;
    x = a[0] * a[1] * a[2] * a[3] * a[n - 1];
    y = a[0] * a[1] * a[n - 1] * a[n - 2] * a[n - 3];
    z = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
    long long res = max(x, max(y, z));
    cout << res << endl;
  }
  return 0;
}
