#include <bits/stdc++.h>
using namespace std;
int a[2005], b[2005];
int main() {
  int n, m;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> b[i];
  printf("%d %d\n", *max_element(a + 1, a + n + 1),
         *max_element(b + 1, b + m + 1));
}
