#include <bits/stdc++.h>
using namespace std;
using ll = long long;
map<ll, int> mp;
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  ll tmp;
  ll a = -1;
  for (int i = 1; i <= n; ++i) {
    cin >> tmp;
    a = max(a, tmp);
    mp[tmp]++;
  }
  ll b = 1;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    if (a % (it->first) == 0) it->second--;
  }
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    if (it->second) b = max(b, it->first);
  }
  cout << a << " " << b << endl;
  return 0;
}
