#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[10005];
int num[10005];
int main() {
  int n;
  scanf("%d", &n);
  int mm = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    num[a[i]]++;
    mm = max(mm, a[i]);
  }
  int nn = 0;
  for (int i = 1; i <= mm; i++) {
    if (mm % i == 0) num[i]--;
  }
  for (int i = 10000; i >= 1; i--) {
    if (num[i] > 0) {
      nn = i;
      break;
    }
  }
  printf("%d %d\n", mm, nn);
  return 0;
}
