#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a;
  int ar[a];
  for (int i = 0; i < a; i++) cin >> ar[i];
  cin >> b;
  int arr[b];
  for (int i = 0; i < b; i++) cin >> arr[i];
  sort(ar, ar + a);
  sort(arr, arr + b);
  cout << ar[a - 1] << " " << arr[b - 1] << endl;
  return 0;
}
