#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
long long a[300000];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
    sort(a + 1, a + 1 + n);
    long long ans = -INF;
    ans = max(ans, a[n] * a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4]);
    ans = max(ans, a[1] * a[2] * a[n] * a[n - 1] * a[n - 2]);
    ans = max(ans, a[1] * a[2] * a[3] * a[4] * a[n]);
    printf("%lld\n", ans);
  }
  return 0;
}
