#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 5;
const ll mod = 998244353;
ll read() {
  ll x = 0;
  char ch = getchar();
  bool flag = false;
  if (ch == '-') {
    flag = true;
    ch = getchar();
  }
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  if (flag)
    return -x;
  else
    return x;
}
int main() {
  if (fopen("in.txt", "r")) freopen("in.txt", "r", stdin);
  int T, n, m, k, i, sum, j, t, tmp;
  scanf("%d", &n);
  int a[1000], vis[10006] = {0};
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a, a + n);
  t = a[n - 1];
  k = a[n - 2];
  vis[t]++;
  for (i = 0; i < n - 1; i++) {
    if (!vis[a[i]] && a[n - 1] % a[i] == 0) {
      vis[a[i]]++;
      a[i] = -1;
    }
  }
  for (i = n - 2; i >= 0; i--)
    if (a[i] != -1) break;
  tmp = a[i];
  if (tmp <= 0) tmp = k;
  printf("%d %d\n", tmp, t);
  return 0;
}
