#include <bits/stdc++.h>
using namespace std;
#define int long long int
const int MOD = 1000000007;
void init_code() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {
//init_code();
int t;
cin >> t;
while (t--) {
int n;
cin>>n;
vector<int> a(n);
for(int i=0;i<n;i++) {
cin>>a[i];
}
int l=0;
int r=n-1;
int target=n-2;
sort(a.begin(),a.end());
while(l<=r) {
if(a[l]*a[r]==target) {
cout<<a[l]<<" "<<a[r]<<"\n";
break;
} else if(a[l]*a[r]<target) {
l++;
} else {
r--;
}
}
//cout<<1<<" "<<n-2<<"\n";
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgaW50IGxvbmcgbG9uZyBpbnQKY29uc3QgaW50IE1PRCA9IDEwMDAwMDAwMDc7Cgp2b2lkIGluaXRfY29kZSgpIHsKI2lmbmRlZiBPTkxJTkVfSlVER0UKICAgIGZyZW9wZW4oImlucHV0LnR4dCIsICJyIiwgc3RkaW4pOwogICAgZnJlb3Blbigib3V0cHV0LnR4dCIsICJ3Iiwgc3Rkb3V0KTsKI2VuZGlmCn0KCmludDMyX3QgbWFpbigpIHsKICAgIC8vaW5pdF9jb2RlKCk7CiAgICBpbnQgdDsKICAgIGNpbiA+PiB0OwogICAgd2hpbGUgKHQtLSkgewogICAgICAgIGludCBuOwogICAgICAgIGNpbj4+bjsKICAgICAgICB2ZWN0b3I8aW50PiBhKG4pOwogICAgICAgIGZvcihpbnQgaT0wO2k8bjtpKyspIHsKICAgICAgICAgICAgY2luPj5hW2ldOwogICAgICAgIH0KICAgICAgICBpbnQgbD0wOwogICAgICAgIGludCByPW4tMTsKICAgICAgICBpbnQgdGFyZ2V0PW4tMjsKICAgICAgICBzb3J0KGEuYmVnaW4oKSxhLmVuZCgpKTsKICAgICAgICB3aGlsZShsPD1yKSB7CiAgICAgICAgICAgIGlmKGFbbF0qYVtyXT09dGFyZ2V0KSB7CiAgICAgICAgICAgICAgICBjb3V0PDxhW2xdPDwiICI8PGFbcl08PCJcbiI7CiAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgfSBlbHNlIGlmKGFbbF0qYVtyXTx0YXJnZXQpIHsKICAgICAgICAgICAgICAgIGwrKzsKICAgICAgICAgICAgfSBlbHNlIHsKICAgICAgICAgICAgICAgIHItLTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICAvL2NvdXQ8PDE8PCIgIjw8bi0yPDwiXG4iOwogICAgfQogICAgcmV0dXJuIDA7Cn0=