#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e5;
inline long long Read() {
  long long x(0), f(1);
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
  return x * f;
}
long long n, Mx = 0, Mi = 0;
long long a[200], cnt[inf];
int main() {
  n = Read();
  for (long long i = 1; i <= n; ++i) {
    a[i] = Read();
    Mx = max(Mx, a[i]);
  }
  for (long long i = 1; i <= Mx; ++i)
    if (Mx % i == 0) ++cnt[i];
  for (long long i = 1; i <= n; ++i) {
    if (cnt[a[i]]) {
      --cnt[a[i]];
    } else {
      Mi = max(Mi, a[i]);
    }
  }
  cout << Mx << ' ' << Mi;
  return 0;
}
