#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 5) {
      int a[5];
      for (int& i : a) cin >> i;
      long long p = 1;
      for (int i : a) p *= i;
      cout << p << "\n";
      continue;
    }
    vector<int> a, b;
    for (int i = 0; i < n; i++) {
      int k;
      cin >> k;
      if (k < 0)
        a.push_back(k);
      else
        b.push_back(k);
    }
    sort(a.begin(), a.end());
    sort(b.rbegin(), b.rend());
    if (!b.size()) {
      long long p = 1;
      for (int i = a.size() - 5; i < a.size(); i++) p *= a[i];
      cout << p << "\n";
    } else {
      long long m1 = a.size() >= 4 && b.size() >= 1
                         ? (long long)a[0] * a[1] * a[2] * a[3] * b[0]
                         : 0;
      long long m2 = a.size() >= 2 && b.size() >= 3
                         ? (long long)a[0] * a[1] * b[0] * b[1] * b[2]
                         : 0;
      long long m3 =
          b.size() >= 5 ? (long long)b[0] * b[1] * b[2] * b[3] * b[4] : 0;
      cout << max(m1, max(m2, m3)) << "\n";
    }
  }
}
