#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += !p[i].rev ? 1 : -1, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (!p[j].rev ? 1 : -1) * i, p[j].n - i, p[j].rev);
		p[j].init(p[j].i, i, p[j].rev);
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		p[l].i = p[l].i + (!p[l].rev ? 1 : -1) * (p[l].n - 1);
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 0);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n, dir;
	void init(int _i, int _n, int _dir) {
		i = _i, n = _n, dir = _dir;
	}
} p[M];

inline void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += p[i].dir, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), 1);
}

inline int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;

	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		p[j + 1].init(p[j].i + (p[j].dir) * i, p[j].n - i, p[j].dir);
		p[j].init(p[j].i, i, p[j].dir);
		j++;
	}
	return j;
}

inline void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		p[l].i = p[l].i + p[l].dir * (p[l].n - 1);
		p[l++].dir *= -1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 1);
	rebuild();

	for (int i = 0; i < m; ++i) {
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans = string(a, a + n);
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#pragma comment(linker, "/STACK:268435456")
#include <stdio.h>
#include<iostream>
#include<cstdio>

#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<bitset>

#include<iomanip>
#include<memory.h>
#include<algorithm>
#include<cstring>
#include<ctime>
#include<cmath>
#include<cassert>

using namespace std;

#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define for1(i, n) for(int i = 1; i < (int)(n); ++i)
#define nfor(i, n) for(int i = int(n) - 1; i >= 0; --i)
#define fore(i, a, b) for(int i = int(a); i < int(b); ++i)
#define correct(x, y, n, m) (0 <= x && x < n && 0 <= y && y < m)
#define x first
#define y second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define sz(v) (int)(v.size())
#define hash archash
#define next arcnext
#define link arclink
#define y0 arcy0
#define y1 arcy1
#define log2 arclog2

template<typename T> inline T abs(T a) { return ((a < 0) ? -a : a); }
template<typename T> inline T sqr(T a) { return a * a; }
template<class T> T gcd(T a, T b) { return a ? gcd(b % a, a) : b; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> T sign(T a) { return a > 0 ? 1 : (a < 0 ? -1 : 0); }

typedef long long li;
typedef unsigned long long uli;
typedef long double ld;
typedef pair <ld, ld> pt;
typedef vector <int> vi;
typedef vector <vector <int> > vvi;
typedef vector <pair <int, int> > vpt;

const int dx[] = { -1, 0, 1,  0 };
const int dy[] = { 0, 1, 0, -1 };
const int dxK[] = { -1, -1, 0, 1, 1,  1,  0, -1 };
const int dyK[] = { 0,  1, 1, 1, 0, -1, -1, -1 };
const int dxKn[] = { -2, -1, 1, 2,  2,  1, -1, -2 };
const int dyKn[] = { 1,  2, 2, 1, -1, -2, -2, -1 };

const int N = int(2e5) + 9;
const int LOGN = 10;
const int SQN = 350;
const int MOD = int(1e9) + 7;
const int INF = int(1e9) + 100;
const li INF64 = 2e18;
const ld PI = ld(3.1415926535897932384626433832795);
const ld EPS = 1e-9;

int n;
int pn;
const int K = 350;
int a[N], b[N];
const int M = K * 3;

struct Part {
	int i, n;
	bool rev;
	Part() { }
	void init(int _i, int _n, int _rev) {
		i = _i, n = _n, rev = _rev;
	}
} p[M];

void rebuild() {
	n = 0;
	forn(i, pn) {
		for (int j = p[i].i; p[i].n; j += !p[i].rev ? 1 : -1, p[i].n--)
			b[n++] = a[j];
	}
	swap(a, b);
	pn = 0;
	for (int i = 0; i < n; i += K)
		p[pn++].init(i, min(K, n - i), false);
}

int split(int i) {
	int j = 0;
	while (j < pn && i >= p[j].n)
		i -= p[j++].n;
	if (i) {
		int k = ++pn;
		while (k > j) p[k] = p[k - 1], k--;
		if (!p[j].rev) {
			p[j + 1].init(p[j].i + i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		else {
			p[j + 1].init(p[j].i - i, p[j].n - i, p[j].rev);
			p[j].init(p[j].i, i, p[j].rev);
		}
		j++;
	}
	return j;
}

void Reverse(int l, int r) {
	l = split(l), r = split(r + 1);
	reverse(p + l, p + r);

	while (l + 1 <= r) {
		if (!p[l].rev)
			p[l].i = p[l].i + p[l].n - 1;
		else
			p[l].i = p[l].i - p[l].n + 1;
		p[l++].rev ^= 1;
	}
}

void solve() {
	cout.sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin >> s;
	n = s.length();
	for (int i = 0; i < n; i++) {
		a[i] = s[i];
	}
	int m;
	cin >> m;

	p[pn++].init(0, n, 0);
	rebuild();

	for (int i = 0; i < m; ++i)	{
		int l, r;
		cin >> l;
		r = n - l + 1;
		l--; r--;
		Reverse(l, r);
		if (pn >= M - 2)
			rebuild();
	}
	rebuild();
	string ans;
	for (int i = 0; i < n; i++) {
		ans += char(a[i]);
	}
	cout << ans << endl;
}
int main() {
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	srand(time(NULL));
	cout << setprecision(10) << fixed;
	cerr << setprecision(10) << fixed;
	solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

ifstream fin("input.txt");
ofstream fout("output.txt");

bool isPrime(int x) { if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
    for (int i = 5; i * i <= x; i += 6) if (x % i == 0 || x % (i + 2) == 0) return 0; return 1; }

inline void boostIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
typedef long int l;
typedef long long int ll;

#define fori(n) for(ll i = 0; i < (n); ++i)
#define forj(n) for(ll j = 0; j < (n); ++j)
#define fork(n) for(ll k = 0; k < (n); ++k)

int main() {
    cout << 13;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

ifstream fin("input.txt");
ofstream fout("output.txt");

bool isPrime(int x) { if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
    for (int i = 5; i * i <= x; i += 6) if (x % i == 0 || x % (i + 2) == 0) return 0; return 1; }

inline void boostIO() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}
typedef long int l;
typedef long long int ll;

#define fori(n) for(ll i = 0; i < (n); ++i)
#define forj(n) for(ll j = 0; j < (n); ++j)
#define fork(n) for(ll k = 0; k < (n); ++k)

int main() {
    cout << "red";
    return 0;
}


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("Even");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("17");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    srand(time(NULL));
    if(rand()&1)puts("Odd");
    else puts("Even");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("00");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("23");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("red");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("14");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("red 5");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("black");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("red Odd");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("5");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("8");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("32");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("Odd");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("0");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("20");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("11");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("26");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    puts("29");
    return 0;
}
/********************

********************/


//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pil pair<int,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define base 1000000000000000000
#define fio ios::sync_with_stdio(false);cin.tie(0)

using namespace std;

const double g=10.0,eps=1e-9;
const int N=100000+10,maxn=100000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f;

int main()
{
    srand(time(NULL));
    if(rand()&1)puts("Odd");
    else puts("Even");
    return 0;
}
/********************

********************/


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("2nd 12");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	srand(time(0));
	cout<< rand()%36+1 <<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("21");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("1");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("3");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("11");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("2 to 1");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	srand(time(0));
	cout<< 0 <<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("29");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	srand(time(0));
	puts(rand()%2 ? "2nd 12" : "1st 12");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("23");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("34");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("4");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("35");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int x;
	cin>>x;
	cout<<x<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("25");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("19");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	srand(time(0));
	cout<< rand()%36+1 <<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("17");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("18");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("31");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("2nd 12");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
	puts("36");
	return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>

int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       long long int  n;
       cin>>n;
       long long int arr[n];
       for(long long int i=0;i<n;i++){
         long long  int a;
           cin>>a;
           arr[i]=a;
       }
      sort(arr,arr+n);
long long int p=LLONG_MIN;
long long int a=arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4]*arr[n-5];
long long int b=arr[n-1]*arr[n-2]*arr[n-3]*arr[0]*arr[1];
long long int c=arr[0]*arr[1]*arr[2]*arr[3]*arr[n-1];
p=max(max(a,b),c);

       cout<<p<<endl;
   }
        return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<long long int> arr)
{
     sort(arr.begin(),arr.end());
int n=arr.size();
long long int p=1;
long long int a=arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4]*arr[n-5];
long long int b=arr[n-1]*arr[n-2]*arr[n-3]*arr[0]*arr[1];
long long int c=arr[0]*arr[1]*arr[2]*arr[3]*arr[n-1];
p=max(max(a,b),c);
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<long long int> arr;
       for(int i=0;i<n;i++){
         long long  int a;
           cin>>a;
           arr.push_back(a);
       }

       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}
/*
#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<long long int> arr)
{
int n=arr.size();
long long int p=1;
if(arr[n-1]==0)
{
p=0;
return p;
}
if(arr[n-1]<0)
{
    for(int k=n-1;k>=n-5;k--)
    p=p*arr[k];
    return p;
}
int l=2;
p=p*arr[n-1];
int i=0,j=n-2;
for(int x=0;x<l;x++)
{
long long    int lp=arr[i]*arr[i+1];
 long long   int rp=arr[j]*arr[j-1];
    if(lp>rp)
     {
         p=p*lp;
         i=i+2;
     }
     else
     {
         p=p*rp;
         j=j-2;
     }

}
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<long long int> arr;
       for(int i=0;i<n;i++){
         long long  int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}*/


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<long long int> arr)
{
int n=arr.size();
long long int p=1;
p=max(max(arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4]*arr[n-5],arr[n-1]*arr[n-2]*arr[n-3]*arr[0]*arr[1]),arr[0]*arr[1]*arr[2]*arr[3]*arr[n-1]);
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<long long int> arr;
       for(int i=0;i<n;i++){
         long long  int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<int> arr)
{
int n=arr.size();
long long int p=1;
if(arr[n-1]==0)
{
p=0;
return p;
}
if(arr[n-1]<0)
{
    for(int k=n-1;k>=n-5;k--)
    p=p*arr[k];
    return p;
}
int l=2;
p=p*arr[n-1];
int i=0,j=n-2;
for(int x=0;x<l;x++)
{
long long    int lp=arr[i]*arr[i+1];
 long long   int rp=arr[j]*arr[j-1];
    if(lp>rp)
     {
         p=p*lp;
         i=i+2;
     }
     else
     {
         p=p*rp;
         j=j-2;
     }

}
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<int> arr;
       for(int i=0;i<n;i++){
           int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<int> arr)
{
int n=arr.size();
int p=1;
if(arr[n-1]==0)
{
p=0;
return p;
}
if(arr[n-1]<0)
{
    for(int k=n-1;k>=n-5;k--)
    p=p*arr[k];
    return p;
}
int l=2;
p=p*arr[n-1];
int i=0,j=n-2;
for(int x=0;x<l;x++)
{
    int lp=arr[i]*arr[i+1];
    int rp=arr[j]*arr[j-1];
    if(lp>rp)
     {
         p=p*lp;
         i=i+2;
     }
     else
     {
         p=p*rp;
         j=j-2;
     }

}
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<int> arr;
       for(int i=0;i<n;i++){
           int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int l=n;
        vector<int> arr;
        while(l--)
        {
            int a;
            cin>>a;
            arr.push_back(a);
        }
        sort(arr.begin(),arr.end());
        vector<int> pos;
        vector<int> neg;
        for(int i=0;i<n;i++)
        {
            if(arr[i]>0)
            pos.push_back(arr[i]);
            else
            neg.push_back(arr[i]);
        }
        int p=1;
        int j=pos.size();
        int k=neg.size();
        if(j>=5)
        {
            for(int x=j-1;x>=j-5;x--)
            {
                p=p*pos[x];
            }
        }
        else if(j>=3&&k>=2)
        {
             for(int x=j-1;x>=j-3;x--)
            {
                p=p*pos[x];
            }
            for(int x=k-1;x>=j-2;x--)
            {
                p=p*neg[x];
            }

        }

        else
        {
            if(j<=1)
            {
                for(int x=k-1;x>=j-5;x--)
            {
                p=p*neg[x];
            }
            }
            else
            {
                for(int x=j-1;x>=j-2;x--)
            {
                p=p*pos[x];
            }
            for(int x=k-1;x>=j-3;x--)
            {
                p=p*neg[x];
            }
            }
        }
        cout<<p<<"\n";
        }
        return 0;
    }


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<int> arr)
{
int n=arr.size();
long long int p=1;
if(arr[n-1]==0)
{
p=0;
return p;
}
if(arr[n-1]<0)
{
    for(int k=n-1;k>=n-5;k--)
    p=p*arr[k];
    return p;
}
int l=2;
p=p*arr[n-1];
int i=0,j=n-2;
for(int x=0;x<l;x++)
{
long long    int lp=arr[i]*arr[i+1];
 long long   int rp=arr[j]*arr[j-1];
    if(lp>rp)
     {
         p=p*lp;
         i=i+2;
     }
     else
     {
         p=p*rp;
         j=j-2;
     }

}
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<long long int> arr;
       for(int i=0;i<n;i++){
         long long  int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}


#include<iostream>
using namespace std;
#include<bits/stdc++.h>
int maxProduct(vector<int> arr)
{
int n=arr.size();
long long int p=1;
if(arr[n-1]==0)
{
p=0;
return p;
}
if(arr[n-1]<0)
{
    for(int k=n-1;k>=n-5;k--)
    p=p*arr[k];
    return p;
}
int l=2;
p=p*arr[n-1];
int i=0,j=n-2;
for(int x=0;x<l;x++)
{
    int lp=arr[i]*arr[i+1];
    int rp=arr[j]*arr[j-1];
    if(lp>rp)
     {
         p=p*lp;
         i=i+2;
     }
     else
     {
         p=p*rp;
         j=j-2;
     }

}
return p;
}
int main()
{

   int t;
   cin>>t;
   while(t--)
   {
       int n;
       cin>>n;
       vector<int> arr;
       for(int i=0;i<n;i++){
           int a;
           cin>>a;
           arr.push_back(a);
       }
       sort(arr.begin(),arr.end());
       int mp=maxProduct(arr);
       cout<<mp<<"\n";
   }
        return 0;
}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    if(pos.size()==0)
    {
        for(int i=neg.size()-1;i>neg.size()-6;i--)
            ans*=neg[i];

        return ans;
    }

    int neg_start=0;
    int pos_start=1;
    ans=1;
    int j=0;

    while(j<2)
    {
        if(pos_start+1<pos.size())
        {
           ll y=pos[pos_start]*pos[pos_start+1];
           ll x=INT_MIN;

           if(neg_start+1<neg.size())
                x=neg[neg_start]*neg[neg_start+1];

           if(x>y)
            {
                ans*=neg[neg_start]*neg[neg_start+1];
                neg_start+=2;
            }

            else
            {
                ans*=pos[pos_start]*pos[pos_start+1];
                pos_start+=2;
            }
        }
        else
        {
            ans*=neg[neg_start]*neg[neg_start+1];
            neg_start+=2;
        }
        j++;
    }

    return ans*pos[0];

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;
    ans=pos[0];
    int j=0;

    if(neg.size()>1)
        {
            while(j<2)
            {
                if(pos_start+1<pos.size())
                {

                    if(neg[neg_start]*neg[neg_start+1]>=pos[pos_start]*pos[pos_start+1])
                        {
                            ans*=neg[neg_start]*neg[neg_start+1];
                            neg_start+=2;
                        }

                    else
                        {
                            ans*=pos[pos_start]*pos[pos_start+1];
                            pos_start+=2;
                        }

                }
                else
                {
                    ans*=neg[neg_start]*neg[neg_start+1];
                    neg_start+=2;

                }
                j++;
            }
            return ans;
        }

    else
    {
        loop(i,1,5)
            ans*=pos[i];

    }
    return ans;
}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    int neg_start=0;
    int pos_start=1;
    ans=pos[0];
    int j=0;

    while(j<2)
    {
        if(pos_start+1<pos.size())
        {
           ll y=pos[pos_start]*pos[pos_start+1];
           ll x=INT_MIN;

           if(neg_start+1<neg.size())
                x=neg[neg_start]*neg[neg_start+1];

           if(x>y)
            {
                ans*=neg[neg_start]*neg[neg_start+1];
                neg_start+=2;
            }

            else
            {
                ans*=pos[pos_start]*pos[pos_start+1];
                pos_start+=2;
            }
        }
        else
        {
            ans*=neg[neg_start]*neg[neg_start+1];
            neg_start+=2;
        }
        j++;
    }

    return ans;

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

int idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;
    ans=pos[0];
    int j=0;

    if(neg.size()>1)
        {
            while(j<2)
            {
                if(pos_start+1<pos.size())
                {

                    if(neg[neg_start]*neg[neg_start+1]>=pos[pos_start]*pos[pos_start+1])
                        {
                            ans*=neg[neg_start]*neg[neg_start+1];
                            neg_start+=2;
                        }

                    else
                        {
                            ans*=pos[pos_start]*pos[pos_start+1];
                            pos_start+=2;
                        }

                }
                else
                {
                    ans*=neg[neg_start]*neg[neg_start+1];
                    neg_start+=2;

                }
                j++;
            }
            return ans;
        }

    else
    {
        loop(i,1,5)
            ans*=pos[i];

    }
    return ans;
}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    ans=pos[0];
    int j=0;

    if(neg.size()>1)
        {
            while(j<2)
            {
                if(pos_start+1<pos.size())
                {

                    if(neg[neg_start]*neg[neg_start+1]>=pos[pos_start]*pos[pos_start+1])
                        {
                            ans*=neg[neg_start]*neg[neg_start+1];
                            neg_start+=2;
                        }

                    else
                        {
                            ans*=pos[pos_start]*pos[pos_start+1];
                            pos_start+=2;
                        }

                }
                else
                {
                    ans*=neg[neg_start]*neg[neg_start+1];
                    neg_start+=2;

                }
                j++;
            }
            return ans;
        }

    else
    {
        loop(i,1,5)
            ans*=pos[i];

    }
    return ans;

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    ans=pos[0];
    int j=0;

    while(j++<2)
    {
        if(pos_start+1<pos.size())
        {
           ll y=pos[pos_start]*pos[pos_start+1];
           ll x=INT_MIN;

           if(neg_start+1<neg.size())
                x=neg[neg_start]*neg[neg_start+1];

           if(x>y)
            {
                ans*=neg[neg_start]*neg[neg_start+1];
                neg_start+=2;
            }

            else
            {
                ans*=pos[pos_start]*pos[pos_start+1];
                pos_start+=2;
            }
        }
        else
        {
            ans*=neg[neg_start]*neg[neg_start+1];
            neg_start+=2;
        }
    }

    return ans;

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    if(pos.size()==0)
    {
        for(int i=neg.size()-1;i>neg.size()-6;i++)
            ans*=neg[i];

        return ans;
    }

    int neg_start=0;
    int pos_start=1;
    ans=1;
    int j=0;

    while(j<2)
    {
        if(pos_start+1<pos.size())
        {
           ll y=pos[pos_start]*pos[pos_start+1];
           ll x=INT_MIN;

           if(neg_start+1<neg.size())
                x=neg[neg_start]*neg[neg_start+1];

           if(x>y)
            {
                ans*=neg[neg_start]*neg[neg_start+1];
                neg_start+=2;
            }

            else
            {
                ans*=pos[pos_start]*pos[pos_start+1];
                pos_start+=2;
            }
        }
        else
        {
            ans*=neg[neg_start]*neg[neg_start+1];
            neg_start+=2;
        }
        j++;
    }

    return ans*pos[0];

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    ans=pos[0];
    int j=0;

    if(neg.size()>1)
        {
            while(j<2)
            {
                if(pos_start+1<pos.size())
                {

                    if(neg[neg_start]*neg[neg_start+1]>pos[pos_start]*pos[pos_start+1])
                        {
                            ans*=neg[neg_start]*neg[neg_start+1];
                            neg_start+=2;
                        }

                    else
                        {
                            ans*=pos[pos_start]*pos[pos_start+1];
                            pos_start+=2;
                        }

                }
                else
                {
                    ans*=neg[neg_start]*neg[neg_start+1];
                    neg_start+=2;

                }
                j++;
                //cout<<ans<<endl;

            }
            return ans;
        }

    else
    {
        loop(i,1,5)
            ans*=pos[i];

    }
    return ans;

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    int neg_start=0;
    int pos_start=1;

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    ans=pos[0];
    int j=0;

    cout<<ans<<endl;
    if(neg.size()>1)
        {
            while(j<2)
            {
                if(pos_start+1<pos.size())
                {

                    if(neg[neg_start]*neg[neg_start+1]>pos[pos_start]*pos[pos_start+1])
                        {
                            ans*=neg[neg_start]*neg[neg_start+1];
                            neg_start+=2;
                        }

                    else
                        {
                            ans*=pos[pos_start]*pos[pos_start+1];
                            pos_start+=2;
                        }

                }
                else
                {
                    ans*=neg[neg_start]*neg[neg_start+1];
                    neg_start+=2;

                }
                j++;
                cout<<ans<<endl;

            }
            return ans;
        }

    else
    {
        loop(i,1,5)
            ans*=pos[i];

    }
    return ans;

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


#include<bits/stdc++.h>
#include <string>
using namespace std;

#define ll long long
#define loop(i,a,n)       for(int i=a;i<n;i++)
#define arri(i,n)       int a[n]; for(int i=0;i<n;i++) cin>>a[i];
#define pb              push_back
#define ff              first
#define ss              second

ll idharsahihoga()
{
    int n;
    cin>>n;
    int a[n];
    vector<int> neg,pos;
    loop(i,0,n)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.pb(a[i]);
        else
            pos.pb(a[i]);
    }

    ll ans=1;
    if(n==5)
    {
        loop(i,0,n)
            ans*=a[i];

        return ans;
    }
    sort(pos.begin(),pos.end(),greater<int>());
    sort(neg.begin(),neg.end());

    if(pos.size()==0)
    {
        loop(i,0,5)
            ans*=neg[i];

        return ans;
    }

    int neg_start=0;
    int pos_start=1;
    ans=1;
    int j=0;

    while(j<2)
    {
        if(pos_start+1<pos.size())
        {
           ll y=pos[pos_start]*pos[pos_start+1];
           ll x=INT_MIN;

           if(neg_start+1<neg.size())
                x=neg[neg_start]*neg[neg_start+1];

           if(x>y)
            {
                ans*=neg[neg_start]*neg[neg_start+1];
                neg_start+=2;
            }

            else
            {
                ans*=pos[pos_start]*pos[pos_start+1];
                pos_start+=2;
            }
        }
        else
        {
            ans*=neg[neg_start]*neg[neg_start+1];
            neg_start+=2;
        }
        j++;
    }

    return ans*pos[0];

}

main()
{
    int t;
    cin>>t;
    while(t--)
    {
        cout<<idharsahihoga();
        cout<<endl;
    }

}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"\n";
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            //break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    bool neg = true;
    for(ll i=0;i<n;i++){
      if(arr[i]>=0) neg = false;
    }
    if(neg) cout<<product<<"\n";
    else{
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    bool neg = true;
    for(ll i=0;i<n;i++){
      if(arr[i]>=0) neg = false;
    }
    if(neg) cout<<product<<"\n";
    else{
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"\n";
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"\n";
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"\n";
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            //break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;
ll memo[200005][6];
ll solvedp(vector<ll> &arr,ll n,ll k){
  if(k>n+1) return MIN;
  if(n<0||k==0) return 1;
  if(arr[n-1]==1) k++;
  ll ans = max(solvedp(arr,n-1,k),arr[n]*solvedp(arr,n-1,k-1));
  memo[n][k] = ans;
  return ans;
}

int main(){
  for(ll i=0;i<200005;i++){
    for(ll j=0;j<6;j++){
      memo[i][j] = MIN;
    }
  }
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    cout<<solvedp(arr,n-1,5)<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          product /= arr[indlastneg];
          product *= newmax;
        }
      }
    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          product /= arr[indlastpos];
          product *= newmax;
        }
      }
    }
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    bool neg = true;
    for(ll i=0;i<n;i++){
      if(arr[i]>0) neg = false;
    }
    if(neg) cout<<product<<"\n";
    else{
      ll p1 , p2;
      p1 = product;
      p2 = product;
      if(product<0){
        if(indlastneg!=-1){
          ll newmax = MIN;
          for(ll i=5;i<n;i++){
            if(arr[i]>=0){
              newmax = arr[i];
              break;
            }
          }
          if(newmax!=MIN){
            p1 /= arr[indlastneg];
            p1 *= newmax;
          }
        }

      }
      if(product<0){
        if(indlastpos!=-1){
          ll newmax = MIN;
          for(ll i=5;i<n;i++){
            if(arr[i]<0){
              newmax = arr[i];
              break;
            }
          }
          if(newmax!=MIN){
            p2 /= arr[indlastpos];
            p2 *= newmax;
          }
        }
      }
      product = max(p1,p2);
      cout<<product<<"\n";
    }
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll indlastpos = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      if(arr[i]>0) indlastpos = i;
      product *= arr[i];
    }
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"\n";
    ll p1 , p2;
    p1 = product;
    p2 = product;
    if(product<0){
      if(indlastneg!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]>=0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p1 /= arr[indlastneg];
          p1 *= newmax;
        }
      }

    }
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    if(product<0){
      if(indlastpos!=-1){
        ll newmax = MIN;
        for(ll i=5;i<n;i++){
          if(arr[i]<0){
            newmax = arr[i];
            //break;
          }
        }
        if(newmax!=MIN){
          p2 /= arr[indlastpos];
          p2 *= newmax;
        }
      }
    }
    product = max(p1,p2);
    cout<<product<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return a>b;
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    // for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
    // cout<<"   " ;
    ll val1 = arr[0]*arr[1]*arr[2]*arr[3]*arr[4];
    ll val2 = arr[0]*arr[1]*arr[2]*arr[n-1]*arr[n-2];
    ll val3 = arr[0]*arr[n-1]*arr[n-2]*arr[n-3]*arr[n-4];
    cout<<max(val1,max(val2,val3))<<"\n";
  }
  return 0;
}


/*
	Solution by:-
	--------------Sannidhay Vashal
	----------------NIT SRINAGAR

*/
#include<iostream>
#include<vector>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<math.h>
#include<climits>
#include<set>
#include<cstring>
#include<unordered_map>
#include <cstdlib>

#define fio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll            long long int
#define ull           unsigned long long int
#define cinll(x)      ll x;cin>>x;
#define cini(x)       int x;cin>>x;
#define cins(x)       string x;cin>>x;
#define vect(x)       vector<ll> x;
#define vect1(x)      vector<ll> x;x.push_back(0);
#define pb(x)         push_back(x)
#define mp(x,y)       make_pair(x,y)
#define MAX           1e18
#define MIN           -1000000007
#define MOD           1000000007

using namespace std;

bool compare(ll a,ll b){
  return abs(a)>abs(b);
}

int main(){
  cinll(t);
  for(ll i=0;i<t;i++){
    cinll(n);
    vector<ll> arr;
    for(ll i=0;i<n;i++){
      cinll(x);arr.pb(x);
    }
    sort(arr.begin(),arr.end(),compare);
    ll indlastneg = -1;
    ll product = 1;
    for(ll i=0;i<5;i++){
      if(arr[i]<0) indlastneg = i;
      product *= arr[i];
    }
    if(product<0){
      ll newmax = MIN;
      for(ll i=indlastneg+1;i<n;i++){
        if(arr[i]>0) newmax = arr[i];
        break;
      }
      if(newmax!=MIN){
        product /= arr[indlastneg];
        product *= newmax;
      }
    }
    cout<<product<<"\n";
  }
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        vector<int> neg, pos;
        bool flag = 0;
        bool zero = false;
        for(int x : a)
        {
            if(x > 0) flag = true;
            if(x == 0) zero = true;
            if(x >= 0) pos.push_back(x);
            else neg.push_back(x);
        }
        if(flag == false && zero == true)
        {
            outline(0);
            continue;
        }
        sortvectorrev(pos);
        sortvector(neg);
        int count = 0;
        int i1 = 0, i2 = 0;
        vector<p> all;
        for(int i = 0; i < pos.size() - 1; i += 2)
        {
            if(i >= pos.size()) break;
            int prod = pos[i]*pos[i + 1];
            all.push_back({prod, 0});
        }
        for(int i = 0; i < neg.size() - 1; i += 2)
        {
            if(i >= neg.size()) break;
            all.push_back({neg[i]*neg[i + 1], 1});
        }
        sortvectorrev(all);
        int ans = 1;
        for(int i = 0; i < 2; i++)
        {
            int x = all[i].first;
            if(all[i].second == 0) i1 += 2;
            else i2 += 2;
            ans *= x;
            count += 2;
        }
        if(i1 < pos.size())
        {
            ans *= pos[i1];
        }
        else if(i2 < neg.size())
        {
            ans *= neg[i2];
        }
        int ans1 = 1;
        count = 0;
        i1 = 0, i2 = 0;
        for(int i = 0; i < all.size(); i++)
        {
            if(count >= 4) break;
            p pp  = all[i];
            if(pp.second == 1)
            {
                ans1 *= pp.first;
                i2 += 2;
                count += 2;
            }
        }
        if(i1 < pos.size())
        {
            ans1 *= pos[i1];
        }
        else if(i2 < neg.size())
        {
            ans1 *= neg[i2];
        }
        outline(max(ans1, ans))
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        vector<int> neg, pos;
        bool flag = 0;
        bool zero = false;
        for(int x : a)
        {
            if(x > 0) flag = true;
            if(x == 0) zero = true;
            if(x >= 0) pos.push_back(x);
            else neg.push_back(x);
        }
        if(flag == false && zero == true)
        {
            outline(0);
            continue;
        }
        sortvectorrev(pos);
        sortvector(neg);
        int count = 0;
        int i1 = 0, i2 = 0;
        vector<p> all;
        for(int i = 0; i < pos.size() - 1; i += 2)
        {
            if(i >= pos.size()) break;
            int prod = pos[i]*pos[i + 1];
            all.push_back({prod, 0});
        }
        for(int i = 0; i < neg.size() - 1; i += 2)
        {
            if(i >= neg.size()) break;
            all.push_back({neg[i]*neg[i + 1], 1});
        }
        sortvectorrev(all);
        int ans = 1;
        for(int i = 0; i < 2; i++)
        {
            int x = all[i].first;
            if(all[i].second == 0) i1 += 2;
            else i2 += 2;
            ans *= x;
            count += 2;
        }
        if(i1 < pos.size())
        {
            ans *= pos[i1];
        }
        else if(i2 < neg.size())
        {
            ans *= neg[i2];
        }
        int ans1 = 1;
        count = 0;
        i1 = 0, i2 = 0;
        for(int i = 0; i < all.size(); i++)
        {
            if(count > 4) break;
            p pp  = all[i];
            if(pp.second == 1)
            {
                ans1 *= pp.first;
                i2 += 2;
                count += 2;
            }
        }
        if(i1 < pos.size())
        {
            ans1 *= pos[i1];
        }
        else if(i2 < neg.size())
        {
            ans1 *= neg[i2];
        }
        outline(max(ans1, ans))
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        int a1 = a[0]*a[1]*a[2]*a[3]*a[n - 1];
        int a2 = a[n - 1]*a[n - 2]*a[n - 3]*a[n - 4]*a[n - 5];
        int a3 = a[0]*a[1]*a[n - 1]*a[n - 2]*a[n - 3];
        int ans = max(a1, max(a2, a3));
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        int ans = inf;
        ans *= -1;
        int a1 = a[0]*a[1]*a[2]*a[3]*a[n - 1];
        int a2 = a[n - 1]*a[n - 2]*a[n - 3]*a[n - 4]*a[n - 5];
        int a3 = a[0]*a[1]*a[n - 1]*a[n - 2]*a[n - 3];
        int ans = max(a1, max(a2, a3))
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        vector<int> neg, pos;
        bool flag = 0;
        bool zero = false;
        for(int x : a)
        {
            if(x > 0) flag = true;
            if(x == 0) zero = true;
            if(x >= 0) pos.push_back(x);
            else neg.push_back(x);
        }
        if(flag == false && zero == true)
        {
            outline(0);
            continue;
        }
        sortvectorrev(pos);
        sortvector(neg);
        int count = 0;
        vector<p> p1, p2;
        for(int i = 0; i < pos.size() - 1; i += 2)
        {
            if(i >= pos.size()) break;
            int prod = pos[i]*pos[i + 1];
            p1.push_back({prod, 0});
        }
        for(int i = 0; i < neg.size() - 1; i += 2)
        {
            if(i >= neg.size()) break;
            p2.push_back({neg[i]*neg[i + 1], 1});
        }
        sortvectorrev(p1);
        sortvectorrev(p2);
        int ans = INT_MIN;
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                if(i + j == 2)
                {
                    int i1 = 0, i2 = 0;
                    int cur = 1;
                    int s = p1.size();
                    if(i > s) continue;
                    if(j > p2.size()) continue;
                    for(int k = 0; k < i; k++)
                    {
                        cur *= p1[k].first;
                        i1 += 2;
                    }
                    s = p2.size();
                    for(int k = 0; k < min(j, s); k++)
                    {
                        // out(p2[k].first)
                        cur *= p2[k].first;
                        i2 += 2;
                    }
                    if(i1 < pos.size())
                    {
                        cur *= pos[i1];
                    }
                    else if(2*j < neg.size())
                    {
                        cur *= neg[neg.size() - 1];
                        // out(cur)
                    }
                    ans = max(ans, cur);
                }
            }
        }
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        vector<int> neg, pos;
        bool flag = 0;
        bool zero = false;
        for(int x : a)
        {
            if(x > 0) flag = true;
            if(x == 0) zero = true;
            if(x >= 0) pos.push_back(x);
            else neg.push_back(x);
        }
        if(flag == false && zero == true)
        {
            outline(0);
            continue;
        }
        sortvectorrev(pos);
        sortvector(neg);
        int count = 0;
        int i1 = 0, i2 = 0;
        vector<p> p1, p2;
        for(int i = 0; i < pos.size() - 1; i += 2)
        {
            if(i >= pos.size()) break;
            int prod = pos[i]*pos[i + 1];
            p1.push_back({prod, 0});
        }
        for(int i = 0; i < neg.size() - 1; i += 2)
        {
            if(i >= neg.size()) break;
            p2.push_back({neg[i]*neg[i + 1], 1});
        }
        sortvectorrev(p1);
        sortvectorrev(p2);
        int ans = INT_MIN;
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                if(i + j == 2)
                {
                    int i1 = 0, i2 = 0;
                    int cur = 1;
                    int s = p1.size();
                    if(i > s) continue;
                    if(j > p2.size()) continue;
                    for(int k = 0; k < min(i, s); k++)
                    {
                        cur *= p1[k].first;
                        i1 += 2;
                    }
                    s = p2.size();
                    for(int k = 0; k < min(j, s); k++)
                    {
                        // out(p2[k].first)
                        cur *= p2[k].first;
                        // out(j)
                        // out(cur)
                        // out(i2)
                        // out(" ")
                        i2 += 2;
                    }
                    if(i1 < pos.size())
                    {
                        cur *= pos[i1];
                    }
                    else if(i2 < neg.size())
                    {
                        // out("Here")
                        // out(neg[i2])
                        cur *= neg[i2];
                        // out(cur)
                    }
                    ans = max(ans, cur);
                }
            }
        }
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        sortvector(a)
        int a1 = a[0]*a[1]*a[2]*a[3]*a[n - 1];
        int a2 = a[n - 1]*a[n - 2]*a[n - 3]*a[n - 4]*a[n - 5];
        int a3 = a[0]*a[1]*a[n - 1]*a[n - 2]*a[n - 3];
        int ans = max(a1, max(a2, a3));
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        vector<int> neg, pos;
        bool flag = 0;
        bool zero = false;
        for(int x : a)
        {
            if(x > 0) flag = true;
            if(x == 0) zero = true;
            if(x >= 0) pos.push_back(x);
            else neg.push_back(x);
        }
        if(flag == false && zero == true)
        {
            outline(0);
            continue;
        }
        sortvectorrev(pos);
        sortvector(neg);
        vector<p> p1, p2;
        for(int i = 0; i < pos.size() - 1; i += 2)
        {
            if(i >= pos.size()) break;
            int prod = pos[i]*pos[i + 1];
            p1.push_back({prod, 0});
        }
        for(int i = 0; i < neg.size() - 1; i += 2)
        {
            if(i >= neg.size()) break;
            p2.push_back({neg[i]*neg[i + 1], 1});
        }
        sortvectorrev(p1);
        sortvectorrev(p2);
        int ans = -inf;
        for(int i = 0; i < 3; i++)
        {
            for(int j = 0; j < 3; j++)
            {
                if(i + j == 2)
                {
                    int i1 = 0, i2 = 0;
                    int cur = 1;
                    int s = p1.size();
                    if(i > s) continue;
                    if(j > p2.size()) continue;
                    for(int k = 0; k < i; k++)
                    {
                        cur *= p1[k].first;
                        i1 += 2;
                    }
                    s = p2.size();
                    for(int k = 0; k < j; k++)
                    {
                        cur *= p2[k].first;
                        i2 += 2;
                    }
                    if(i1 < pos.size())
                    {
                        cur *= pos[i1];
                    }
                    else if(2*j < neg.size())
                    {
                        cur *= neg[neg.size() - 1];
                    }
                    ans = max(ans, cur);
                }
            }
        }
        outline(ans)
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define mod 1000000007
#define endl "\n"
#define p pair<int, int>
#define arrinp(i, a, start, end); for(ll i = start; i <= end; i++) cin >> a[i];
#define arrout(i, a, start, end); for(ll i = start; i <= end; i++) cout << a[i] << " ";
#define swap(a, b) {a = a + b; b = a - b; a = a - b;
#define forfront(i, start, end) for(ll i = start; i <= end; i++)
#define forback(i, start, end) for(ll i = start; i >= end; i--)
#define out(x) cout << x << " ";
#define outline(x) cout << x << endl;
#define sortvector(v) sort(v.begin(), v.end());
#define sortvectorrev(v) sort(v.rbegin(), v.rend());
#define inf INT64_MAX
int32_t main()
{
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        arrinp(i, a, 0, n - 1);
        int a1 = a[0]*a[1]*a[2]*a[3]*a[n - 1];
        int a2 = a[n - 1]*a[n - 2]*a[n - 3]*a[n - 4]*a[n - 5];
        int a3 = a[0]*a[1]*a[n - 1]*a[n - 2]*a[n - 3];
        int ans = max(a1, max(a2, a3))
        outline(ans)
    }
    return 0;
}