#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  int m;
  cin >> m;
  vector<int> b(m);
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(b.begin(), b.end());
  cout << a[a.size() - 1] << " " << b[b.size() - 1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) solve();
  return 0;
}
