#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  int a = 0, b = 0, x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x > a) a = x;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x > b) b = x;
  }
  cout << a << " " << b;
  return 0;
}
