#include <bits/stdc++.h>
using namespace std;
void busted() {
  int n;
  cin >> n;
  multiset<int> a;
  int x;
  while (n--) {
    cin >> x;
    a.insert(x);
  }
  int ans = *prev(a.end());
  for (int i = 1; i <= sqrt(ans); i++) {
    if (ans % i == 0) {
      if (ans / i == i)
        a.erase(a.find(i));
      else {
        a.erase(a.find(i));
        a.erase(a.find(ans / i));
      }
    }
  }
  cout << ans << " " << *prev(a.end()) << '\n';
  return;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  busted();
  return 0;
}
