#include <bits/stdc++.h>
using namespace std;
int a[101], b[101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, i;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
  }
  cin >> m;
  for (i = 0; i < m; ++i) {
    cin >> b[i];
  }
  sort(a, a + n);
  sort(b, b + m);
  cout << a[n - 1] << " " << b[m - 1] << endl;
  return 0;
}
