#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a[140], m = 0, x, y, vis[40010];
  memset(vis, 0, sizeof(vis));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    m = max(m, a[i]);
  }
  x = m;
  m = 0;
  for (int i = 0; i < n; i++) {
    if (x % a[i] == 0) {
      if (vis[a[i]])
        m = max(m, a[i]);
      else
        vis[a[i]] = 1;
    } else
      m = max(m, a[i]);
  }
  printf("%d %d\n", x, m);
  return 0;
}
