#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, p, q, x = 0, y = 0;
  cin >> a;
  while (a--) {
    cin >> p;
    x = max(x, p);
  }
  cin >> b;
  while (b--) {
    cin >> q;
    y = max(y, q);
  }
  cout << x << " " << y << endl;
}
