#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ma1 = 0, m2 = 0;
  while (n--) {
    int a;
    cin >> a;
    ma1 = max(ma1, a);
  }
  int m;
  cin >> m;
  while (m--) {
    int a;
    cin >> a;
    m2 = max(m2, a);
  }
  cout << ma1 << " " << m2 << endl;
}
