#include <bits/stdc++.h>
using namespace std;
long long n, m, k, t, p, q, r, u, flag, counter;
string a, b, c, d;
vector<long long> v;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m;
    v.push_back(m);
  }
  sort((v).begin(), (v).end());
  p = v[n - 1];
  cin >> n;
  v.clear();
  for (int i = 0; i < n; i++) {
    cin >> m;
    v.push_back(m);
  }
  sort((v).begin(), (v).end());
  q = v[n - 1];
  cout << p << ' ' << q;
  return 0;
}
