#include <bits/stdc++.h>
const double eps = 1e-8;
const double pi = acos(-1.0);
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int maxn = 5e5 + 7;
using namespace std;
int arr[maxn];
int main(void) {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
    }
    sort(arr, arr + n);
    long long ans = -inf;
    for (int i = 0; i < 5; i += 2) {
      long long t = 1;
      for (int j = 0; j < i; j++) t *= arr[j];
      for (int j = n - 1; j >= n - (5 - i); j--) t *= arr[j];
      ans = max(ans, t);
    }
    printf("%lld\n", ans);
  }
  return 0;
}
