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