include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N=100010;
int a[N];//记录数字出现次数
int main(){
int m,n,line,num,max1,min1;
cin>>line;
while(line–){
while(cin>>num){
a[num]++;
}
}
for(int i=0;i<N;i++){
if(a[i]==2){
n=i;
}
if(a[i]==0&&a[i-1]!=0&&a[i+1]!=0){
m=i;
}
}
cout<<m<<" "<<n;
return 0;
}