#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n,k,x; cin >> n;
k = n - 2;
int a[n];
map<int,int>ch;
for(int i=0;i<n;i++) cin >> a[i];
for(int i=0;i<n;i++){
x = a[i];
if(k % x == 0){
if(ch.find(k / x) != ch.end()){
cout << x << " " << k / x << endl;
break;
}
}
ch[x]++;
}
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBsbCBsb25nIGxvbmcKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglpbnQgdDsJY2luID4+IHQ7Cgl3aGlsZSh0LS0pewoJCWludCBuLGsseDsJY2luID4+IG47CgkJayA9IG4gLSAyOwoJCWludCBhW25dOwoJCW1hcDxpbnQsaW50PmNoOwoJCWZvcihpbnQgaT0wO2k8bjtpKyspCWNpbiA+PiBhW2ldOwoJCWZvcihpbnQgaT0wO2k8bjtpKyspewoJCQl4ID0gYVtpXTsKCQkJaWYoayAlIHggPT0gMCl7CgkJCQlpZihjaC5maW5kKGsgLyB4KSAhPSBjaC5lbmQoKSl7CgkJCQkJY291dCA8PCB4IDw8ICIgIiA8PCBrIC8geCA8PCBlbmRsOwoJCQkJCWJyZWFrOwoJCQkJfQoJCQl9CQoJCQljaFt4XSsrOwoJCX0KCX0KCXJldHVybiAwOwp9