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