#include <bits/stdc++.h>
using namespace std;
namespace tttt {}
using namespace tttt;
const int maxn = 1e5 + 5;
int n, m, a, b, ma = -1e9, mb = -1e9;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a), ma = max(a, ma);
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &b), mb = max(b, mb);
  printf("%d %d", ma, mb);
  return 0;
  ;
}
