#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e4 + 5;
bool vis[MAXN];
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int fdv = a[n - 1];
  vis[fdv] = 1;
  a[n - 1] = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] and !vis[a[i]] and (fdv % a[i]) == 0) {
      vis[a[i]] = 1;
      a[i] = 0;
    }
  }
  sort(a, a + n);
  cout << fdv << ' ' << a[n - 1];
}
