#include <bits/stdc++.h>
using namespace std;
int n, mx1, mx2, x;
int main() {
  cin >> n;
  cin >> mx1;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    mx1 = max(mx1, x);
  }
  cin >> n >> mx2;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    mx2 = max(mx2, x);
  }
  cout << mx1 << ' ' << mx2;
  return 0;
}
