#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, m, f, sum = 0;
  cin >> n;
  vector<int> a;
  for (int i = 0; i < n; i++) {
    cin >> k;
    a.push_back(k);
  }
  cin >> m;
  vector<int> b;
  for (int i = 0; i < m; i++) {
    cin >> k;
    b.push_back(k);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  cout << a[n - 1] << " " << b[m - 1];
}
