#include <bits/stdc++.h>
using namespace std;
vector<long long int> v, v2, v3;
set<int> st;
set<int>::iterator it;
long long int a[10006], cnt[10006];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    st.insert(a[i]);
    cnt[a[i]]++;
  }
  sort(a, a + n);
  if (cnt[a[n - 1]] == 2) {
    cout << a[n - 1] << " " << a[n - 1] << endl;
    return 0;
  } else {
    int ans = a[n - 1];
    cout << ans << " ";
    for (it = st.begin(); it != st.end(); it++) {
      if (ans % (*it) == 0) {
        cnt[*it]--;
      }
    }
    for (int i = 10000; i >= 1; i--) {
      if (cnt[a[i]] == 1) {
        cout << a[i] << endl;
        break;
      }
    }
  }
  return 0;
}
