#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int mini1 = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mini1 = max(mini1, a[i]);
  }
  int mini2 = 0;
  cin >> n;
  int b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    mini2 = max(mini2, b[i]);
  }
  cout << mini1 << " " << mini2 << endl;
}
