#include<cstdio>
#include<algorithm>
using namespace std;
long long A[200010];
long long B[200010];
int main()
{
int n1,n2;
scanf("%d",&n1);
int i,j,k;
for(i=0; i<n1; i++){
scanf("%lld",&A[i]);
}
scanf("%d",&n2);
for(i=0; i<n2; i++){
scanf("%lld",&B[i]);
}
int mid = (n1+n2-1)/2;
i = j = k = 0;
while(i<n1&&j<n2&&k<mid){
if(A[i]<B[j]){
i++;
}
else{
j++;
}
k++;
}
int flag=0;
while(i<n1&&k<mid){
flag=1;
i++;k++;
}
while(j<n2&&k<mid){
flag=2;
j++;k++;
}
if(flag==0){
if(i<n1&&A[i]<B[j]){//一定要加i<n1,因为测试数据中怕i越界
printf("%lld",A[i]);
}
else printf("%lld",B[j]);
}
else if(flag==1)printf("%lld",A[i]);
else printf("%lld",B[j]);
return 0;
}