#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
    vector<int>pos;
    vector<int>neg;
    for(int i=0;i<n;i++){
       if(a[i]>=0){
          pos.pb(a[i]);

       }else{
          neg.pb(a[i]);

       }
    }
    sort(pos.rbegin(),pos.rend());
    sort(neg.begin(),neg.end());
    ll sum=1;
    if(n==5){
       for(int i=0;i<5;i++){
          sum=sum*a[i];

       }
    }else

    if(pos.size()==1){
       for(int i=0;i<4;i++){
          sum=sum*neg[i];

       }
       sum=sum*pos[0];

    }else
    if(pos.size()==0){
       for(int i=0;i<5;i++){
         sum=sum*neg[i];

       }

    }else
    if(neg.size()==0||neg.size()==1){
       for(int i=0;i<5;i++){
          sum=sum*pos[i];

       }
    }else
    {
      int sz=pos.size();
      if(sz%2==0){
         sz=sz-1;
      }
      int s=neg.size();
      if(s%2!=0){
         s=s-1;
      }
       int x=5;
       int j=0;
       int k=0;
       while(j+1<sz&&k+1<s&&x!=1){
         if(pos[j]*pos[j+1]>neg[k]*neg[k+1]){
            sum=sum*(pos[j]*pos[j+1]);
            j=j+2;
            x=x-2;

         }else{
            sum=sum*(neg[k]*neg[k+1]);
            k=k+2;
            x=x-2;

         }

       }
       while(j<sz&&x!=0){

             sum=sum*pos[j];
             j++;
             x--;

       }
       while(k<s&&x!=0){

             sum=sum*neg[k];
             k++;
             x--;

       }

    }
    cout<<sum<<endl;
}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>=0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

      for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      int p=1;
      int p1=1;
      ll p2=1;
      for(int i=n-1;i>=n-5;i--){
         p2=p2*a[i];

      }
       for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
    vector<int>pos;
    vector<int>neg;
    for(int i=0;i<n;i++){
       if(a[i]>=0){
          pos.pb(a[i]);

       }else{
          neg.pb(a[i]);

       }
    }
    sort(pos.rbegin(),pos.rend());
    sort(neg.begin(),neg.end());
    ll sum=1;

    if(pos.size()==1){
       for(int i=0;i<4;i++){
          sum=sum*neg[i];

       }
       sum=sum*pos[0];

    }else
    if(pos.size()==0){
       for(int i=0;i<5;i++){
         sum=sum*neg[i];

       }

    }else
    if(neg.size()==0||neg.size()==1){
       for(int i=0;i<5;i++){
          sum=sum*pos[i];

       }
    }else
    {
      int sz=pos.size();
      if(sz%2==0){
         sz=sz-1;
      }
       int x=5;
       int j=0;
       int k=0;
       while(j+1<sz&&k+1<neg.size()&&x!=1){
         if(pos[j]*pos[j+1]>neg[k]*neg[k+1]){
            sum=sum*(pos[j]*pos[j+1]);
            j=j+2;
            x=x-2;

         }else{
            sum=sum*(neg[k]*neg[k+1]);
            k=k+2;
            x=x-2;

         }

       }
       while(j<sz&&x!=0){

             sum=sum*pos[j];
             j++;
             x--;

       }
       while(k<neg.size()&&x!=0){

             sum=sum*neg[k];
             k++;
             x--;

       }

    }
    cout<<sum<<endl;
}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[n-1-i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

     for(int i=0;i<3;i++){
        p=p*a[n-1-i];
     }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=0;i<5;i++){
         p2=p2*a[n-1-i];

      }
       for(int i=0;i<3;i++){
         p=p*a[n-1-i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>=0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

      for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      int p=1;
      int p1=1;
      int p2=1;
      for(int i=n-1;i>=n-5;i--){
         p2=p2*a[i];

      }
       for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
    vector<int>pos;
    vector<int>neg;
    for(int i=0;i<n;i++){
       if(a[i]>=0){
          pos.pb(a[i]);

       }else{
          neg.pb(a[i]);

       }
    }
    sort(pos.rbegin(),pos.rend());
    sort(neg.begin(),neg.end());
    ll sum=1;

    if(pos.size()==0){
       for(int i=0;i<5;i++){
         sum=sum*neg[i];

       }

    }else
    if(neg.size()==0||neg.size()==1){
       for(int i=0;i<5;i++){
          sum=sum*pos[i];

       }
    }else
    {
      int sz=pos.size();
      if(sz%2==0){
         sz=sz-1;
      }
       int x=5;
       int j=0;
       int k=0;
       while(j+1<sz&&k+1<neg.size()&&x!=0){
         if(pos[j]*pos[j+1]>neg[k]*neg[k+1]){
            sum=sum*(pos[j]*pos[j+1]);
            j=j+2;
            x=x-2;

         }else{
            sum=sum*(neg[k]*neg[k+1]);
            k=k+2;
            x=x-2;

         }

       }
       while(j<sz&&x!=0){

             sum=sum*pos[j];
             j++;
             x--;

       }
       while(k<neg.size()&&x!=0){

             sum=sum*neg[k];
             k++;
             x--;

       }

    }
    cout<<sum<<endl;
}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   ll a[n];
   ll x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
   sort(a,a+n);
   for(int i=n-1;i>=0;i--){
      if(a[i]>0){
         x++;

      }
   }

   if(x==0){
      ll sum=1;

      for(int i=0;i<5;i++){
       sum=sum*a[n-1-i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      ll p=1;
      for(int i=0;i<4;i++){
         p=p*a[i];

      }
      p=p*a[n-1];

      cout<<p<<endl;
      continue;

   }else
   if(x==3||x==4){
      ll p=1;
      ll p1=1;

     for(int i=0;i<3;i++){
        p=p*a[n-1-i];
     }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=0;i<5;i++){
         p2=p2*a[n-1-i];

      }
       for(int i=0;i<3;i++){
         p=p*a[n-1-i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>=0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

      for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=n-1;i>=n-5;i--){
         p2=p2*a[i];

      }
       for(int i=n-1;i>=(n-3);i--){
         p=p*a[i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
    vector<int>pos;
    vector<int>neg;
    for(int i=0;i<n;i++){
       if(a[i]>=0){
          pos.pb(a[i]);

       }else{
          neg.pb(a[i]);

       }
    }
    sort(pos.rbegin(),pos.rend());
    sort(neg.begin(),neg.end());
    ll sum=1;
    if(n==5){
       for(int i=0;i<5;i++){
          sum=sum*a[i];

       }
    }else

    if(pos.size()==1){
       for(int i=0;i<4;i++){
          sum=sum*neg[i];

       }
       sum=sum*pos[0];

    }else
    if(pos.size()==0){
       for(int i=0;i<5;i++){
         sum=sum*neg[i];

       }

    }else
    if(neg.size()==0||neg.size()==1){
       for(int i=0;i<5;i++){
          sum=sum*pos[i];

       }
    }else
    {
      int sz=pos.size();
      if(sz%2==0){
         sz=sz-1;
      }
       int x=5;
       int j=0;
       int k=0;
       while(j+1<sz&&k+1<neg.size()&&x!=1){
         if(pos[j]*pos[j+1]>neg[k]*neg[k+1]){
            sum=sum*(pos[j]*pos[j+1]);
            j=j+2;
            x=x-2;

         }else{
            sum=sum*(neg[k]*neg[k+1]);
            k=k+2;
            x=x-2;

         }

       }
       while(j<sz&&x!=0){

             sum=sum*pos[j];
             j++;
             x--;

       }
       while(k<neg.size()&&x!=0){

             sum=sum*neg[k];
             k++;
             x--;

       }

    }
    cout<<sum<<endl;
}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];

    }
   sort(a,a+n);
   for(int i=n-1;i>=0;i--){
      if(a[i]>0){
         x++;

      }
   }

   if(x==0){
      ll sum=1;

      for(int i=0;i<5;i++){
       sum=sum*a[n-1-i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=1;
      for(int i=0;i<4;i++){
         p=p*a[i];

      }
      p=p*a[n-1];

      cout<<p<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

     for(int i=0;i<3;i++){
        p=p*a[n-1-i];
     }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=0;i<5;i++){
         p2=p2*a[n-1-i];

      }
       for(int i=0;i<3;i++){
         p=p*a[n-1-i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>=0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

     for(int i=0;i<3;i++){
        p=p*a[n-1-i];
     }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=0;i<5;i++){
         p2=p2*a[n-1-i];

      }
       for(int i=0;i<3;i++){
         p=p*a[n-1-i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<utility>
using namespace std;
#define ll long long
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i, n) for(int i=n-1;i>=0;i--)
long long mod=1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//to find nth fibonacci number.
//This code returns Fn and Fn+1 as a pair.
pair<int, int> fib (int n) {
    if (n == 0)
        return {0, 1};

    auto p = fib(n >> 1);
    int c = p.first * (2 * p.second - p.first);
    int d = p.first * p.first + p.second * p.second;
    if (n & 1)
        return {d, c + d};
    else
        return {c, d};
}

ll fact(ll n)
{
    ll res=1;
    for(ll i=n;i>=1;i--)
        (res*=i)%=mod;
    return (res%mod);

}

int pow(int a, int b, int m)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(ans*a)%m;
		b/=2;
		a=(a*a)%m;
	}
	return ans;
}

bool isPrime(long long n)
{

    if (n <= 1)
        return false;

    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;

    return true;
}

//THIS IS THE CODE TO FIND ALL PRIME NUMBERS IN THE RANGE "L" to "R";

vector<long long > segmentedSieve(long long L, long long R) {
    // generate all primes up to sqrt(R)
    long long lim = sqrt(R);
    vector<bool> mark(lim + 1, false);
    vector<long long> primes;
    for (long long i = 2; i <= lim; ++i) {
        if (!mark[i]) {
            primes.emplace_back(i);
            for (long long j = i * i; j <= lim; j += i)
                mark[j] = true;
        }
    }

    vector<bool> isPrime(R - L + 1, true);
    for (long long i : primes)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    vector<long long >realprime;
   for(int i=0;i<=R-L;i++){
      if(isPrime[i]){
         realprime.emplace_back(i+L);

      }
   }
    return realprime;

}

bool isPalindrome(string s)
{

    int l = 0;
    int h = s.size()-1;

    while (h > l)
    {
        if (s[l++] != s[h--])
        {

            return false;
        }
    }
   return true;
}

int ternarySearch(int l, int r, int key, int ar[])

{
    while (r >= l) {

        // Find the mid1 and mid2
        int mid1 = l + (r - l) / 3;
        int mid2 = r - (r - l) / 3;

        // Check if key is present at any mid
        if (ar[mid1] == key) {
            return mid1;
        }
        if (ar[mid2] == key) {
            return mid2;
        }

        // Since key is not present at mid,
        // check in which region it is present
        // then repeat the Search operation
        // in that region

        if (key < ar[mid1]) {

            // The key lies in between l and mid1
            r = mid1 - 1;
        }
        else if (key > ar[mid2]) {

            // The key lies in between mid2 and r
            l = mid2 + 1;
        }
        else {

            // The key lies in between mid1 and mid2
            l = mid1 + 1;
            r = mid2 - 1;
        }
    }

    // Key not found
    return -1;
}

  int binarySearch(int arr[], int l, int r, int x)
{
    while (l <= r) {
        int m = l + (r - l) / 2;

        // Check if x is present at mid
        if (arr[m] == x)
            return m;

        // If x greater, ignore left half
        if (arr[m] < x)
            l = m + 1;

        // If x is smaller, ignore right half
        else
            r = m - 1;
    }

    // if we reach here, then element was
    // not present
    return -1;
}

//"KADANE'S ALGORITHM"
//iski time complexity o(n) hn i.e the smallest possible
long long maxsubarraysum(long long *array,long long n){
   long long best = 0, sum = 0;
for (long long  k = 0; k < n; k++) {
sum = max(array[k],sum+array[k]);
best = max(best,sum);
}
return  best ;

}
//to add two very large numbers

string findSum(string str1, string str2)
{
	if (str1.length() > str2.length())
		swap(str1, str2);
	string str = "";
	int n1 = str1.length(), n2 = str2.length();

	reverse(str1.begin(), str1.end());
	reverse(str2.begin(), str2.end());

	int carry = 0;
	for (int i=0; i<n1; i++)
	{

		int sum = ((str1[i]-'0')+(str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');

		carry = sum/10;
	}
	for (int i=n1; i<n2; i++)
	{
		int sum = ((str2[i]-'0')+carry);
		str.push_back(sum%10 + '0');
		carry = sum/10;
	}
	if (carry)
		str.push_back(carry+'0');
	reverse(str.begin(), str.end());
	return str;
}

string smin(string a,string b)
{

if(a.size()<b.size())return a;
if(a.size()>b.size())return b;
if(a<=b)return a;
else return b;
}

  bool so(const pair<ll,ll> &a,
              const pair<ll,ll> &b)
{
    return (a.second < b.second);
}

int main(){
ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--){
   int n;
   cin>>n;
   int a[n];
   int x=0;
    for(int i=0;i<n;i++){
       cin>>a[i];
       if(a[i]>0){
          x++;

       }
    }
   sort(a,a+n);
   ll sum=1;

   if(x==0){

      for(int i=0;i<5;i++){
       sum=sum*a[i];

      }
      cout<<sum<<endl;
      continue;

   }else
   if(x==1||x==2){
      int p=0;
      for(int i=0;i<4;i++){
         sum=sum*a[i];

      }
      p=a[n-1];
      sum=sum*p;
      cout<<sum<<endl;
      continue;

   }else
   if(x==3||x==4){
      int p=1;
      int p1=1;

     for(int i=0;i<3;i++){
        p=p*a[n-1-i];
     }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,p1)<<endl;

      continue;

   }else
   if(x==5||x>5){
      ll p=1;
      ll p1=1;
      ll p2=1;
      for(int i=0;i<5;i++){
         p2=p2*a[n-1-i];

      }
       for(int i=0;i<3;i++){
         p=p*a[n-1-i];

      }
      p=p*a[0];
      p=p*a[1];
      for(int i=0;i<4;i++){
         p1=p1*a[i];

      }
      p1=p1*a[n-1];
      cout<<max(p,max(p1,p2))<<endl;
      continue;

   }

}
return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
        if (*max_element(a.begin(), a.end()) <= 0) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] << el;
            continue;
        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
        if (s >= 0)
            cout << s << el;
        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                ll new_s = s / a[n - j];

                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i];
            }
            cout << ma << el;
        }
    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;
//        if (s >= 0)
//            cout << s << el;
//        else {
            ll ma = s, new_s;
            for (ll j = 1; j <= 5; j++) {
                    new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[notj];

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] << el;
            continue;
        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
        if (s >= 0)
            cout << s << el;
        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                ll new_s = s / a[n - j];

                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i];
            }
            cout << ma << el;
        }
    }
    return 0;
}


// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;
        vector<ll> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
//        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

        ll ma = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL, new_s;
        for (ll j = 1; j <= 5; j++) {
            new_s = 1;
            for (ll notj = 1; notj <= 5; notj++)
                if (notj != j)
                    new_s *= a[n - notj] * 1LL;

            for (ll i = 0; i < n - 5; i++)
                if (new_s * a[i] * 1LL > ma)
                    ma = new_s * a[i] * 1LL;
        }
        cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
//        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

            ll ma = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL, new_s;
            for (ll j = 1; j <= 5; j++) {
                new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[n - notj] * 1LL;

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
            continue;
        }
//        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

            ll ma = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL, new_s;
            for (ll j = 1; j <= 5; j++) {
                new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[n - notj] * 1LL;

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

            ll ma = s, new_s;
            for (ll j = 1; j <= 5; j++) {
                new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[n - notj];

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] << el;
            continue;
        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
        if (s >= 0)
            cout << s << el;
        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                ll new_s = s / a[n - j];
                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i];
            }
            cout << max(s, ma) << el;
        }
    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;
//        if (s >= 0)
//            cout << s << el;
//        else {
            ll ma = s;
            for (ll j = 1; j <= 5; j++) {
                if (a[n - j] == 0)
                    continue;
                ll new_s = s / a[n - j];
                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) <= abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
        if (*max_element(a.begin(), a.end()) < 0) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
            continue;
        }
//        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

            ll ma = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL, new_s;
            for (ll j = 1; j <= 5; j++) {
                new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[n - notj] * 1LL;

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (ll a, ll b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
        if (*max_element(a.begin(), a.end()) < 0) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
            continue;
        }
//        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;

            ll ma = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL, new_s;
            for (ll j = 1; j <= 5; j++) {
                new_s = 1;
                for (ll notj = 1; notj <= 5; notj++)
                    if (notj != j)
                        new_s *= a[n - notj] * 1LL;

                for (ll i = 0; i < n - 5; i++)
                    if (new_s * a[i] * 1LL > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;
//        if (s >= 0)
//            cout << s << el;
//        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                if (a[n - j] == 0)
                    continue;
                ll new_s = s / a[n - j];
                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << max(s, ma) << el;

    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
            continue;
        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;
        if (s >= 0)
            cout << s << el;
        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                ll new_s = s / a[n - j];
                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << max(s, ma) << el;
        }
    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
        if (*max_element(a.begin(), a.end()) <= 0 || n == 5) {
            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] << el;
            continue;
        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5];
        if (s >= 0)
            cout << s << el;
        else {
            ll ma = -LONG_LONG_MAX;
            for (int j = 1; j <= 5; j++) {
                ll new_s = s / a[n - j];

                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i];
            }
            cout << ma << el;
        }
    }
    return 0;
}


//
// :author:   Polusummator
// :date:     14.09.2020 20:45
// :filename: 1406B.cpp
// :team:     Little PyPy Squad
//
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define Yes cout << "Yes" << el
#define No cout << "No" << el
#define fori(start, n) for (auto i = start; i < n; i++)
#define el '\n'
#define printa(array) for (auto i : array) cout << i << ' '; cout << endl;
#define printm(matrix) for (auto & i : matrix) {\
                            for (auto j : i) {\
                                cout << j << ' ';}\
                                cout << endl;}
#define cinar(arr) for (auto & i : arr) {\
                        cin >> i;}
#define cinma(matr) for (auto & i : matr) {\
                        cinar(i);}
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

bool comp (int a, int b) {
    return abs(a) < abs(b);
}

int main() {
    fastIO;
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        cinar(a);
        sort(a.begin(), a.end(), comp);
//        printa(a);
//        if (*max_element(a.begin(), a.end()) < 0 || n == 5) {
//            cout << a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL << el;
//            continue;
//        }
        ll s = a[n - 1] * a[n - 2] * a[n - 3] * a[n - 4] * a[n - 5] * 1LL;
//        if (s >= 0)
//            cout << s << el;
//        else {
            ll ma = s;
            for (int j = 1; j <= 5; j++) {
                if (a[n - j] == 0)
                    continue;
                ll new_s = s / a[n - j];
                for (int i = 0; i < n - 5; i++)
                    if (new_s * a[i] > ma)
                        ma = new_s * a[i] * 1LL;
            }
            cout << ma << el;

    }
    return 0;
}