#include <bits/stdc++.h>
using namespace std;
void Solve() {
  int n;
  cin >> n;
  vector<int> factor(n);
  for (int i = 0; i < n; i++) {
    cin >> factor[i];
  }
  sort(factor.begin(), factor.end());
  bool m = false;
  int highest = factor[factor.size() - 1];
  cout << highest << ' ';
  int p = 0, q = 0;
  for (int i = 0; i + 1 < n; i++) {
    if (factor[i] == factor[i + 1]) {
      p = max(p, factor[i]);
    }
  }
  for (int i = 0; i + 1 < n; i++) {
    if (highest % factor[i]) {
      q = max(factor[i], q);
    }
  }
  cout << max(q, p);
}
int main() {
  {
    Solve();
    cout << '\n';
  }
  return 0;
}
