#include #include #include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; using vi = vector; using vvi = vector; using vvvi = vector; using vll = vector; using vvll = vector; using vvvll = vector; using vmi = vector; using vvmi = vector; using vvvmi = vector; #define all(a) (a).begin(), (a).end() #define rep2(i, m, n) for (int i = (m); i < (n); ++i) #define rep(i, n) rep2(i, 0, n) #define drep2(i, m, n) for (int i = (m)-1; i >= (n); --i) #define drep(i, n) drep2(i, n, 0) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t--){ int n; cin >> n; vll a(n); rep(i, n)cin >> a[i]; sort(all(a)); if(a[0] >= 0){ cout << a[0]*a[n-1] << endl; continue; } if(a[n-1] < 0){ cout << a[n-1]*a[0] << endl; continue; } int it = 0; while(a[it] < 0)it++; cout << a[it]*a[it-1] << endl; } return 0; }