#include <bits/stdc++.h>
const int maxn = 2e2 + 10;
const int mod = 1e9 + 7;
const int inf = 1e8;
using namespace std;
int main() {
  int n, a[maxn] = {0};
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int ans1 = a[n], ans2 = 0;
  int vis[10005];
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i < n; i++)
    if (ans1 % a[i] == 0 && a[i] != a[i + 1]) vis[i] = 1;
  for (int i = n - 1; i >= 1; i--) {
    if (!vis[i]) {
      ans2 = a[i];
      break;
    }
  }
  printf("%d %d\n", ans1, ans2);
  return 0;
}
