#include <bits/stdc++.h>
using namespace std;
void showvector(vector<long long int> v) {
  for (long long int x : v) cout << x << " ";
  cout << endl;
}
bool comp(pair<long long int, long long int> a,
          pair<long long int, long long int> b) {
  return (a.first > b.first);
}
void fun() {
  long long int n;
  while (cin >> n) {
  }
}
void vfun() {
  long long int n, k;
  while (cin >> n) {
    vector<long long int> v(n);
    for (long long int i = 0; i < n; i++) cin >> v[i];
    cin >> k;
    vector<long long int> v1(k);
    for (long long int i = 0; i < k; i++) cin >> v1[i];
    sort(v.begin(), v.end());
    sort(v1.begin(), v1.end());
    cout << v[n - 1] << " " << v1[k - 1] << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long int test = 1;
  while (test--) {
    vfun();
  }
  return 0;
}
