#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, a, b, c = 0, n, m, p;
  cin >> n;
  long long arr[n];
  for (i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  m = arr[n - 1];
  for (i = n - 1; i > 0; i--) {
    if (m % arr[i] != 0 || arr[i] == arr[i - 1]) {
      p = arr[i];
      break;
    }
  }
  cout << m << " " << p << endl;
  return 0;
}
