#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n = 1, ans1 = 0, ans2 = 0;
  cin >> n;
  long long A[n];
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
    ans1 = max(ans1, A[i]);
  }
  long long m;
  cin >> m;
  long long B[m];
  for (long long i = 0; i < m; i++) {
    cin >> B[i];
    ans2 = max(ans2, B[i]);
  }
  cout << ans1 << " " << ans2;
}
