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