#include <bits/stdc++.h>
using namespace std;
int bs(int first, int begin, int end, int a[], int key);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t, n;
  cin >> t;
  while (t--) {
    cin >> n;
    vector<long long> a(n);
    for (auto &it : a) cin >> it;
    sort(a.begin(), a.end());
    long long onePossibility =
        a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
    long long anotherPossibility = a[n - 1] * a[n - 2] * a[n - 3] * a[0] * a[1];
    long long yetAnotherPossibility = a[n - 1] * a[0] * a[1] * a[2] * a[3];
    long long semiFinals = max(onePossibility, anotherPossibility);
    cout << max(semiFinals, yetAnotherPossibility) << endl;
  }
  return 0;
}
int bs(int begin, int end, int arr[], int key) {
  if (begin <= end) {
    int mid = (begin + end) / 2;
    if (arr[mid] == key)
      return mid + 1;
    else if (arr[mid] < key)
      return bs(mid + 1, end, arr, key);
    else
      return bs(begin, mid - 1, arr, key);
  }
  return -1;
}
