#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<int> a, b;
  int n;
  cin >> n;
  int tt;
  for (long long i = 0; i < n; i++) {
    cin >> tt;
    a.push_back(tt);
  }
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> tt;
    b.push_back(tt);
  }
  sort(a.rbegin(), a.rend());
  sort(b.rbegin(), b.rend());
  cout << a[0] << " " << b[0] << "\n";
  return 0;
}
