#include<iostream>
#include<vector>
using namespace std;
int main(){
int n,m,cnt=0,ans,i,j;
cin>>n;
vector<int> a1(n+1);
for(i=1; i<=n;i++) scanf("%d", &a1[i]);
cin>>m;
vector<int> a2(m+1);
for(i=1; i<=m;i++) scanf("%d", &a2[i]);
int target=(m+n+1)/2;
i=1,j=1;
while (i<=n&&j<=m){
ans=a1[i] <= a2[j] ? a1[i++] : a2[j++];
if(++cnt==target)break;
}
if(i <= n && cnt < target)
ans = a1[i + target - cnt - 1];
else if(j <= m && cnt < target)
ans = a2[j + target - cnt - 1];
printf("%d", ans);
system("pause");
return 0;
}