#include <bits/stdc++.h>
using namespace std;
int main() {
  int n1, n2, x;
  set<int> x1, x2;
  cin >> n1;
  for (int i = 0; i < n1; i++) {
    cin >> x;
    x1.insert(x);
  }
  cin >> n2;
  for (int i = 0; i < n2; i++) {
    cin >> x;
    x2.insert(x);
  }
  cout << *x1.rbegin() << " " << *x2.rbegin();
}
