#include <bits/stdc++.h>
using namespace std;
int n, a[200], b[10005];
int x, y;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) b[a[i]]++;
  x = a[n];
  for (int i = 1; i <= x; i++)
    if (x % i == 0) b[i]--;
  for (int i = x; i >= 1; i--)
    if (b[i]) {
      y = i;
      break;
    }
  cout << x << ' ' << y;
}
