#include <bits/stdc++.h>
using namespace std;
vector<long long int> v, v2, v3;
set<int> st;
set<int>::iterator it;
long long int a[10006], cnt[10006];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = n - 1; i >= 0; i--) {
    if (a[n - 1] % a[i] != 0 || a[i] == a[i - 1]) {
      cout << a[n - 1] << " " << a[i] << endl;
      return 0;
    }
  }
  return 0;
}
