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