#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  multiset<long long> m;
  for (long long i = 0; i < n; i++) {
    long long ele;
    cin >> ele;
    m.insert(ele);
  }
  long long res1 = *prev(m.end());
  for (long long i = 1; i <= res1; i++) {
    if (res1 % i == 0) m.erase(m.find(i));
  }
  cout << res1 << " " << *prev(m.end());
}
