#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m;
  cin >> n;
  int arrn[n];
  for (i = 0; i < n; i++) cin >> arrn[i];
  cin >> m;
  int arrm[m];
  for (i = 0; i < m; i++) cin >> arrm[i];
  sort(arrn, arrn + n);
  sort(arrm, arrm + m);
  cout << arrn[n - 1] << " " << arrm[m - 1] << endl;
  return 0;
}
