#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n, a, j, l, l1, i, cnt = 0;
  vector<ll> vm, v, v1;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    vm.push_back(a);
  }
  sort(vm.begin(), vm.end());
  for (i = 0; i < n - 1; i++) {
    if (vm[i] == vm[i + 1]) {
      v.push_back(vm[i]);
      i++;
    } else {
      if (vm[vm.size() - 1] % vm[i] != 0) v.push_back(vm[i]);
    }
  }
  cout << vm[vm.size() - 1] << " " << v[v.size() - 1] << endl;
  return 0;
}
