#include <bits/stdc++.h>
using namespace std;
int main() {
  bool arr[1001];
  memset(arr, 0, sizeof(arr));
  int n, m;
  cin >> n;
  vector<int> v, u;
  for (int x = 0; x < n; x++) {
    int a;
    cin >> a;
    v.push_back(a);
    arr[a] = 1;
  }
  cin >> m;
  for (int x = 0; x < m; x++) {
    int a;
    cin >> a;
    u.push_back(a);
    arr[a] = 1;
  }
  bool printed = 0;
  for (int x = 0; x < n; x++) {
    int a = v[x];
    for (int y = 0; y < m; y++) {
      int b = u[y];
      if (!arr[a + b] && !printed) {
        cout << a << " " << b << endl;
        printed = 1;
      }
    }
  }
}
