#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> num;
    v.push_back(num);
  }
  sort(v.begin(), v.end());
  int ans1 = v.back(), ans2;
  for (int i = 1; i <= ans1; i++) {
    if (ans1 % i == 0) {
      v.erase(find(v.begin(), v.end(), i));
    }
  }
  cout << ans1 << " " << v.back() << endl;
  return 0;
}
