#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, max1 = 0, max2 = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    max1 = max(max1, x);
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    max2 = max(max2, x);
  }
  cout << max1 << " " << max2;
  return 0;
}
