#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<string, long long int> &a,
               const pair<string, long long int> &b) {
  return (a.second < b.second);
}
bool isPalindrome(string sp) {
  long long int n = sp.size();
  for (long long int k = 0; k < n; k++) {
    long long int i = n - k - 1;
    if (sp[k] != sp[i]) return false;
  }
  return true;
}
int main() {
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, sum = 1;
    cin >> n;
    long long int arr[n];
    std::vector<long long int> v, v1;
    for (long long int i = 0; i < n; i++) {
      cin >> arr[i];
      if (arr[i] >= 0) {
        v.push_back(arr[i]);
      } else {
        v1.push_back(arr[i]);
      }
    }
    sort(v.begin(), v.end(), greater<int>());
    sort(v1.begin(), v1.end());
    sort(arr, arr + n);
    if (n == 5) {
      for (long long int i = 0; i < n; i++) {
        sum *= arr[i];
      }
      cout << sum << endl;
    } else {
      long long int x = arr[0] * arr[1] * arr[n - 1] * arr[n - 2] * arr[n - 3];
      long long int y = arr[0] * arr[1] * arr[n - 1] * arr[3] * arr[2];
      long long int z =
          arr[n - 5] * arr[n - 1] * arr[n - 2] * arr[n - 3] * arr[n - 4];
      cout << max(x, max(y, z)) << endl;
    }
  }
}
