#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n;
  int max1 = 0, max2 = 0;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t > max1) max1 = t;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    if (t > max2) max2 = t;
  }
  printf("%d %d\n", max1, max2);
}
int main(int argc, char const *argv[]) {
  solve();
  return 0;
}
