#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, t1, a[1000], b[1000], c[1000], i, j, l, k = 0, m = 0, maax = -1,
                                                 maax1 = -1;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> a[i];
    if (maax1 < a[i]) {
      maax1 = a[i];
    }
  }
  cin >> t1;
  for (int i = 0; i < t1; i++) {
    cin >> b[i];
    if (maax < b[i]) {
      maax = b[i];
    }
  }
  cout << maax1 << " " << maax;
  return 0;
}
