#include <bits/stdc++.h>
using namespace std;
// #Searching #Problem #GFG
// https://www.geeksforgeeks.org/find-a-repeating-and-a-missing-number/
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int x,y; // x-missing y-repeating
vector<int> a(n);
vector<int> count(n+1,0); // 0 to n
count[0]=-1; // 0 not included in problem
for(int i=0;i<n;i++){
cin>>a[i];
count[a[i]]++;
if(count[a[i]]==2){
y=a[i];
}
}
for(int i=1;i<n;i++){
if(count[i]==0){
x=i;
}
}
cout<<x<<" "<<y<<endl;
}
return 0;
}