#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, y[105];
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> y[i];
  sort(y, y + n);
  cout << y[n - 1] << " ";
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> y[i];
  sort(y, y + n);
  cout << y[n - 1];
  return 0;
}
