code
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int C;
vector<int> vec;
while(cin>>C){
//TODO multiple input
while(C--){
int cnt;
cin>>cnt;
while(cnt--){
int num;
cin>>num;
vec.push_back(num);
}
sort(vec.begin(),vec.end());
cout<<vec[1]<<'\n';
}
}
return 0;
}