#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> elems(n);
  set<int> been;
  long long first = 1;
  long long second = 1;
  for (int i = 0; i < n; i++) {
    cin >> elems[i];
  }
  sort(elems.begin(), elems.end());
  first = elems[elems.size() - 1];
  for (int i = elems.size() - 1; i >= 0; i--) {
    if (first % elems[i] != 0 || been.count(elems[i]) != 0) {
      second = elems[i];
      break;
    }
    been.insert(elems[i]);
  }
  cout << first << " " << second << endl;
  return 0;
}
