#include <bits/stdc++.h>
using namespace std;
long long int input(long long int n, vector<long long int> &ve);
long long int input(long long int n, vector<long long int> &ve) {
  long long int val;
  for (long long int i = 0; i < n; i++) {
    cin >> val;
    ve.push_back(val);
  }
  return 0;
}
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n, a, m;
  long long int max1 = -1, max2 = -1;
  vector<long long int> v;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> a;
    if (a > max1) {
      max1 = a;
    }
  }
  cin >> m;
  for (long long int i = 0; i < m; i++) {
    cin >> a;
    if (a > max2) {
      max2 = a;
    }
  }
  cout << max1 << " " << max2 << endl;
  return 0;
}
