#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) cin >> v[i];
    sort(v.begin(), v.end());
    long long answer = 1;
    for (int i = 0; i < 5; ++i) answer *= v[i];
    for (int left = 0; left <= 5; ++left) {
      long long tmp = 1;
      int right = 5 - left;
      for (int i = 0; i < left; ++i) tmp *= v[i];
      int j = n - 1;
      while (right > 0) {
        tmp *= v[j];
        j -= 1;
        right -= 1;
      }
      answer = max(answer, tmp);
    }
    cout << answer << endl;
  }
  return 0;
}
