#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#define maxn 1000010
using namespace std;
//9 10 11 12 //13// 14 15 16 17
//归并排序的归并操作
int a[maxn];
int b[maxn];
int c[maxn*2];
int main() {
    int n,m;
    cin>>n;
    for(int i=0;i<n;i++)cin>>a[i];//cout<<a[i]<<endl;
    cin>>m;
    for(int i=0;i<m;i++)cin>>b[i];//cout<<b[i]<<endl;
    int l1=0,l2=0,l=0;
    while(l1<n&&l2<m)
    {
        while(a[l1]<=b[l2]&&l1<n)c[l++] = a[l1++];
        while(a[l1]> b[l2]&&l2<m)c[l++] = b[l2++];
    }
    while(l1<n)
    {
        c[l++] = a[l1++];
    }
    while(l2<m)
    {
        c[l++] = b[l2++];
    }
  //  cout<<l<<endl;
    if(l%2!=0)cout<<c[l/2]<<endl;
    else cout<<c[(l-1)/2];


}
// 64 位输出请用 printf("%lld")