#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
int vis[10005];
int main() {
  int n;
  scanf("%d", &n);
  int maxn = -1;
  for (int i = 1; i <= n; i++) {
    int tmp;
    scanf("%d", &tmp);
    vis[tmp]++;
    maxn = max(maxn, tmp);
  }
  long long ans1 = -1, ans2 = -1;
  for (int i = 1; i <= maxn; i++) {
    if (vis[i] != 0) {
      if (i > ans1) {
        ans1 = i;
      }
    }
  }
  for (int i = 1; i <= maxn; i++) {
    if (vis[i] == 2 || (ans1 % i != 0 && vis[i] == 1)) {
      if (i > ans2) {
        ans2 = i;
      }
    }
  }
  printf("%lld %lld\n", ans1, ans2);
}
