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