#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d", &n);
  int max1 = 0, max2 = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    if (max1 < x) {
      max1 = x;
    }
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    int x;
    scanf("%d", &x);
    if (max2 < x) {
      max2 = x;
    }
  }
  printf("%d %d\n", max1, max2);
  return 0;
}
