#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int A[n], m1 = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> A[i];
    if (A[i] > m1) {
      m1 = A[i];
    }
  }
  long long int m, m2 = 0;
  cin >> m;
  long long int B[m];
  for (long long int i = 0; i < m; i++) {
    cin >> B[i];
    if (B[i] > m2) {
      m2 = B[i];
    }
  }
  cout << m1 << " " << m2 << endl;
  return 0;
}
