#include <bits/stdc++.h>
using namespace std;
int a[110010];
int main() {
  int n;
  scanf("%d", &n);
  int mx1 = 0, mx2 = 0;
  for (int i = 1, x; i <= n; ++i) scanf("%d", &x), mx1 = max(mx1, x);
  scanf("%d", &n);
  for (int i = 1, x; i <= n; ++i) scanf("%d", &x), mx2 = max(mx2, x);
  printf("%d %d\n", mx1, mx2);
}
