#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i;
  int* a = new int[n];
  int max = -1;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > max) max = a[i];
  }
  int m, flag = 0;
  cin >> m;
  int* b = new int[m];
  for (i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] > max) {
      flag = 1;
      max = b[i];
    }
  }
  if (flag == 0)
    cout << max << " " << b[0] << endl;
  else
    cout << a[0] << " " << max << endl;
  return 0;
}
