#include <bits/stdc++.h>
using namespace std;
int Arr[100005];
int max5[5];
int main() {
  int t, n, temp;
  long long p1, p2, p3, p4, p5, p6;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    cin >> n;
    for (int j = 0; j < n; ++j) cin >> Arr[j];
    sort(Arr, Arr + n);
    p1 = Arr[n - 1] * Arr[n - 2];
    p1 *= Arr[n - 4] * Arr[n - 5];
    p1 *= Arr[n - 3];
    p2 = Arr[n - 1] * Arr[n - 2];
    p2 *= Arr[0] * Arr[1];
    p2 *= Arr[n - 3];
    p3 = Arr[n - 1] * Arr[0];
    p3 *= Arr[2] * Arr[3];
    p3 *= Arr[1];
    p4 = Arr[n - 1] * Arr[n - 2];
    p4 *= Arr[n - 3];
    p4 *= Arr[n - 4] * Arr[0];
    p5 = Arr[0] * Arr[1];
    p5 *= Arr[3] * Arr[4];
    p5 *= Arr[2];
    p6 = Arr[n - 1] * Arr[n - 2];
    p6 *= Arr[1] * Arr[2];
    p6 *= Arr[0];
    p1 = max(p1, p6);
    p2 = max(p2, p5);
    p3 = max(p3, p4);
    cout << max(p1, max(p2, p3)) << endl;
  }
  return 0;
}
