#include <bits/stdc++.h>
using namespace std;
const int N = 10005, M = 1000005;
const long long MOD = 1e9 + 7;
const double eps = 1e-9;
int n, a[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  if (a[n - 1] == a[n - 2]) {
    printf("%d %d\n", a[n - 1], a[n - 1]);
    return 0;
  }
  printf("%d ", a[n - 1]);
  for (int i = n - 2; i >= 0; i--) {
    if (a[n - 1] % a[i] || (i && a[i] == a[i - 1])) {
      printf("%d\n", a[i]);
      return 0;
    }
  }
  return 0;
}
