#include <bits/stdc++.h>
using namespace std;
int arr[10000];
int barr[10000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m;
  cin >> n;
  int a = 0, b = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    a = max(arr[i], a);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> barr[i];
    b = max(barr[i], b);
  }
  cout << a << " " << b << endl;
  return 0;
}
