#include <bits/stdc++.h>
using namespace std;
int n, t;
vector<int> a;
vector<int> b;
int vis[10005];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> t;
    a.push_back(t);
    ++vis[t];
  }
  auto x = *max_element(a.begin(), a.end());
  for (int i = 0; i < n; ++i)
    if (x % a[i]) b.push_back(a[i]);
  int y = 0;
  if (!b.empty())
    y = *max_element(b.begin(), b.end());
  else {
    for (int i = 0; i < n; ++i) {
      if (vis[a[i]] == 2 && a[i] > y) y = a[i];
    }
  }
  cout << x << ' ' << y << endl;
  return 0;
}
