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

int main(){
	int t,n,x,y;	cin >> t;
	while(t--){
		cin >> n;
		multiset<int>s;
		bool found  = false;
		for(int i=0;i<n;i++){
			cin >> x;
			s.insert(x);
		}
		if(s.size() == 3)	cout << "1 1\n";
		else{
			for(auto it=s.begin();it!=s.end();++it){
				if(s.find((n-2) / *it) != s.end() && s.find((n-2) / *it) != it){
					cout << *it << " " << (n-2) / *it << endl;
					break;
				}
			}
		}
	}
	return 0;
}