#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i, a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int x = a[n - 1];
  i = n - 2;
  while (i > 0) {
    if (x % a[i] != 0)
      break;
    else if (x % a[i] == 0 && (a[i - 1] == a[i] || a[i] == a[i + 1]))
      break;
    i--;
  }
  cout << x << " " << a[i];
  return 0;
}
