#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int mod = 998244353;
int main() {
  int n;
  cin >> n;
  int max1 = 0;
  int in;
  for (int i = 0; i < n; i++) {
    cin >> in;
    if (in > max1) max1 = in;
  }
  int m;
  cin >> m;
  int max2 = 0;
  for (int i = 0; i < m; i++) {
    cin >> in;
    if (in > max2) max2 = in;
  }
  cout << max1 << " " << max2;
  return 0;
}
