#include <bits/stdc++.h>
#pragma GCC optimize("inline")
using namespace std;
const int N = 1e6 + 200;
long long n;
int a[N], t[N];
long long modulo(long long a, long long b, long long n) {
  long long x = 1, y = a;
  while (b > 0) {
    if (b % 2 == 1) {
      x = (x * y) % n;
    }
    y = (y * y) % n;
    b /= 2;
  }
  return x % n;
}
int main() {
  cin >> n;
  long long i = 0, ma = 0, n2 = n;
  while (n--) {
    cin >> a[i];
    t[a[i]]++;
    i++;
  }
  n = n2;
  sort(a, a + n);
  long long x = 0, y = a[n - 1];
  i = 0;
  long long ii = -1;
  while (n--) {
    if (y % a[i]) x = a[i];
    if (t[a[i]] == 2) ii = i;
    i++;
  }
  if (x)
    cout << x;
  else
    cout << a[ii];
  cout << " " << y;
}
