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