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