#include<bits/stdc++.h>
using namespace std;
int main() {
int a = 0,b = 0;
int n,m,x;
cin>>n;
for(int i = 0;i < n;i ++ ) {
cin>>x;
a = max(a,x);
}
cin>>m;
for(int i = 0;i < m;i ++ ) {
cin>>x;
b = max(b,x);
}
cout<<a<<" "<<b;
}