#include <bits/stdc++.h>
using namespace std;
unsigned long long n, a[130], i, b = 1, f[10002];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  sort(a + 1, a + n + 1);
  cout << a[n] << ' ';
  for (i = 1; i < n; i++) {
    if (f[a[i]] == 1 && a[n] % a[i] != 0) {
      b = a[i];
    } else if (f[a[i]] == 2) {
      b = a[i];
    }
  }
  cout << b;
  return 0;
}
