#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  long long a = 0, b = 0;
  for (long long i = 0; i < n; i++) {
    long long j;
    cin >> j;
    a = max(a, j);
  }
  long long m;
  cin >> m;
  for (long long i = 0; i < m; i++) {
    long long j;
    cin >> j;
    b = max(b, j);
  }
  cout << a << " " << b;
  return 0;
}
