#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int a, b, c, d, m, n, p, q, r, x, y, z, aa, bb, cc, dd;
  long long int i, j, k, l;
  long long int cnt = 0, cnt1 = 0, cnt2 = 0, cnt3 = 0, sum = 0, mx = LLONG_MIN,
                mn = LLONG_MIN;
  long long int flag = 0, flag2 = 0;
  vector<long long int> vec1, vec2, vec3;
  string s1, s2, s3;
  cin >> n;
  for (long long int i = (long long int)(0); i < (long long int)(n); ++i) {
    cin >> x;
    mx = max(mx, x);
  }
  cin >> m;
  for (long long int i = (long long int)(0); i < (long long int)(m); ++i) {
    cin >> x;
    mn = max(mn, x);
  }
  cout << mx << " " << mn << endl;
}
int main() {
  ios::sync_with_stdio(false);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
