#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-12;
const long long mod = 1e9 + 7;
const int N = 1e6 + 5;
const int oo = 1e9;
int n, t[N], ans1, ans2, occ[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t[i];
    occ[t[i]]++;
  }
  sort(t, t + n);
  ans1 = t[n - 1];
  for (int i = n - 2; i >= 0; i--) {
    if (occ[t[i]] > 1 || ans1 % t[i]) {
      ans2 = t[i];
      break;
    }
  }
  cout << ans1 << " " << ans2;
}
