#include <bits/stdc++.h>
using namespace std;
int n, m;
int maxa, maxb;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int t;
    cin >> t;
    maxa = max(maxa, t);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int t;
    cin >> t;
    maxb = max(maxb, t);
  }
  cout << maxa << ' ' << maxb << endl;
  return 0;
}
