#include <bits/stdc++.h>
using namespace std;
int N, M, max_a = 0, max_b = 0, temp;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> temp;
    max_a = max(max_a, temp);
  }
  cin >> M;
  for (int i = 0; i < M; i++) {
    cin >> temp;
    max_b = max(max_b, temp);
  }
  cout << max_a << " " << max_b;
  return 0;
}
