#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7, maxn = 100011;
std::vector<long long int> adj[maxn];
std::vector<long long int> v1;
std::vector<long long int> v;
long long int ans, n, k, m, x, y, q, par[maxn], h[maxn], mach[maxn], sk[maxn];
bool mark[maxn];
long long int dfs(long long int f) {
  mark[f] = 1;
  for (long long int i = 0; i < adj[f].size(); i++)
    if (mark[adj[f][i]] == 0) dfs(adj[f][i]);
  v1.push_back(f);
}
int32_t main() {
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  long long int b[m];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  cout << a[n - 1] << " " << b[m - 1];
  return 0;
}
