#include <bits/stdc++.h>
int64_t arr[100005];
int main() {
  int t;
  int n;
  int left;
  int right;
  int64_t pLeft;
  int64_t pRight;
  int64_t ans;
  std ::cin >> t;
  while (t--) {
    ans = 1;
    pLeft = 1;
    pRight = 1;
    std ::cin >> n;
    left = 0;
    right = n - 1;
    for (int i = 0; i < n; i++) {
      std ::cin >> arr[i];
    }
    std ::sort(arr, arr + n);
    for (int i = 0; i < 5; i++) {
      pLeft *= arr[i];
      pRight *= arr[n - 1 - i];
    }
    std ::cout << std ::max(
                      {arr[0] * arr[1] * arr[n - 1] * arr[n - 2] * arr[n - 3],
                       arr[0] * arr[1] * arr[2] * arr[3] * arr[n - 1], pLeft,
                       pRight})
               << '\n';
  }
}
