#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500;
int visa[MAXN], visb[MAXN], a[MAXN], b[MAXN];
int main() {
  int n, m;
  int flag = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    visa[a[i]]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    visb[b[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (!visa[a[i]]) continue;
    for (int j = 1; j <= m; j++) {
      if (visb[b[j]]) {
        int t = a[i] + b[j];
        if (!visa[t] && !visb[t]) {
          printf("%d %d", a[i], b[j]);
          flag = 1;
          break;
        }
      }
    }
    if (flag) break;
  }
  return 0;
}
