#include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int array[n];
for (int i=0; i<n; i++)
cin>>array[i];
sort(array,array+n);
cout<<array[n-1]*array[n-2]<<endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CmludCBtYWluKCl7CiAgICBpbnQgdDsKICAgIGNpbj4+dDsKICAgIHdoaWxlKHQtLSl7CiAgICAgICAgaW50IG47CiAgICAgICAgY2luPj5uOwogICAgICAgIGludCBhcnJheVtuXTsKICAgICAgICBmb3IgKGludCBpPTA7IGk8bjsgaSsrKQogICAgICAgICAgICBjaW4+PmFycmF5W2ldOwogICAgICAgIHNvcnQoYXJyYXksYXJyYXkrbik7CiAgICAgICAgY291dDw8YXJyYXlbbi0xXSphcnJheVtuLTJdPDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=