#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const int a, const int b) { return abs(a) > abs(b); }
int main() {
  int test;
  cin >> test;
  while (test--) {
    long long int n, lastn, lastp = 0, prod = 1, flag = 0;
    cin >> n;
    vector<int> arr;
    for (int p = 0; p < n; p++) {
      int x;
      cin >> x;
      arr.push_back(x);
      if (x > 0) flag = 1;
    }
    sort(arr.begin(), arr.end(), sortbysec);
    int i;
    for (i = 0; i < 5; i++) {
      prod *= arr[i];
      if (arr[i] < 0)
        lastn = arr[i];
      else
        lastp = arr[i];
    }
    if (prod >= 0 || n == 5)
      cout << prod << endl;
    else if (flag == 0) {
      prod = 1;
      for (int i = n - 1; i >= n - 5; i--) prod *= arr[i];
      cout << prod << endl;
    } else {
      long long int x = prod, y = prod;
      int j = i;
      while (arr[j] < 0 && j < n) j++;
      if (j < n) {
        x = x / lastn;
        x = x * arr[j];
      }
      while (arr[i] >= 0 && i < n) i++;
      if (i < n && lastp != 0) {
        y = y / lastp;
        y = y * arr[i];
      }
      cout << max(x, y) << endl;
    }
  }
  return 0;
}
