#include <bits/stdc++.h>
using namespace std;
void busted() {
  int n;
  cin >> n;
  vector<int> freq(10005, 0);
  vector<int> div;
  int x;
  int mx = 0;
  while (n--) {
    cin >> x;
    freq[x]++;
    mx = max(mx, x);
  }
  cout << mx << " ";
  for (int i = 1; i <= sqrt(mx); i++) {
    if (mx % i == 0) {
      if (mx / i == i)
        div.push_back(i);
      else {
        div.push_back(i);
        div.push_back(mx / i);
      }
    }
  }
  for (int i = 0; i < div.size(); i++) freq[div[i]]--;
  for (int i = freq.size(); i >= 0; i--) {
    if (freq[i] == 1) {
      cout << i << "\n";
      break;
    }
  }
  return;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  busted();
  return 0;
}
