#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
long long n, t;
cin >> n;
vector<long long> v1, v2, v;
for (int i = 0; i < n; i++) {
scanf("%lld", &t);
v1.push_back(t);
}
int m;
cin >> m;
for (int i = 0; i < m; i++) {
scanf("%lld", &t);
v2.push_back(t);
}
int i, j;
for (i = 0, j = 0; i < v1.size() && j < v2.size(); ) {
while (v1[i] < v2[j] && i < v1.size()){
v.push_back(v1[i++]);
}
while (v2[j] < v1[i] && j < v2.size()) {
v.push_back(v2[j++]);
}
}
while (i < v1.size()) {
v.push_back(v1[i++]);
}
while (j < v2.size()) {
v.push_back(v2[j++]);
}
if (v.size() % 2 == 1) {
cout << v[v.size()/2] << endl;
}else{
cout << v[v.size()/2-1] << endl;
}
return 0;
}