#include <bits/stdc++.h>
using namespace std;
map<long long int, long long int> mp, mk;
set<long long int> s1, s2;
vector<long long int> v, w, v1;
long long int a[2000006], b[2000006];
string s = "", p = "", q = "";
char ch;
long long int m, n, c, i, j, k, l, r, x, t, y, u, e, f, g, h, mn, mx, d;
int main() {
  cin >> t;
  while (t--) {
    cin >> n;
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    sort(a + 1, a + n + 1);
    d = max(max(a[n] * a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4],
                a[n] * a[n - 1] * a[n - 2] * a[1] * a[2]),
            a[n] * a[1] * a[2] * a[3] * a[4]);
    cout << d << endl;
  }
}
