/*#include <stdio.h>
#include <stdlib.h>
int *arr1, *arr2, *newArr;
int main(){
int len1,len2;
while(scanf("%d",&len1) != EOF){
arr1 = (int *)malloc(len1*4);
int i;
for(i=0;i<len1;i++){
scanf("%d",&arr1[i]);
}
scanf("%d",&len2);
arr2 = (int *)malloc(len2*4);
newArr = (int *)malloc((len1+len2)*4);
for(i=0;i<len2;i++){
scanf("%d",&arr2[i]);
}
i=0;
int index = 0;
int j = 0;
while(i<len1 && j<len2){
if(arr1[i] < arr2[j]){
newArr[index++] = arr1[i++];
}else{
newArr[index++] = arr2[j++];
}
}
while(i < len1)
newArr[index++] = arr1[i++];
while(j < len2)
newArr[index++] = arr2[j++];
printf("%d\n",newArr[(index-1)/2]);
}
return 0;
}*/
# include<iostream>
# include<algorithm>
using namespace std;
long long a[2000005];
int main()
{
long long n=0,i=0,m=0;
while(cin>>n)
{
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>m;
for(i=n;i<n+m;i++)
{
cin>>a[i];
}
sort(a,a+m+n);
long long k=(m+n+1)/2;
cout<<a[k-1]<<endl;
}
return 0;
}
#include <stdlib.h>
int *arr1, *arr2, *newArr;
int main(){
int len1,len2;
while(scanf("%d",&len1) != EOF){
arr1 = (int *)malloc(len1*4);
int i;
for(i=0;i<len1;i++){
scanf("%d",&arr1[i]);
}
scanf("%d",&len2);
arr2 = (int *)malloc(len2*4);
newArr = (int *)malloc((len1+len2)*4);
for(i=0;i<len2;i++){
scanf("%d",&arr2[i]);
}
i=0;
int index = 0;
int j = 0;
while(i<len1 && j<len2){
if(arr1[i] < arr2[j]){
newArr[index++] = arr1[i++];
}else{
newArr[index++] = arr2[j++];
}
}
while(i < len1)
newArr[index++] = arr1[i++];
while(j < len2)
newArr[index++] = arr2[j++];
printf("%d\n",newArr[(index-1)/2]);
}
return 0;
}*/
# include<iostream>
# include<algorithm>
using namespace std;
long long a[2000005];
int main()
{
long long n=0,i=0,m=0;
while(cin>>n)
{
for(i=0;i<n;i++)
{
cin>>a[i];
}
cin>>m;
for(i=n;i<n+m;i++)
{
cin>>a[i];
}
sort(a,a+m+n);
long long k=(m+n+1)/2;
cout<<a[k-1]<<endl;
}
return 0;
}