#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, a, b, k, l;
  cin >> n;
  vector<int> d;
  for (int i = 0; i < n; i++) {
    cin >> a;
    d.push_back(a);
  }
  if (d.size() == 2) {
    cout << "1 1"
         << "\n";
    return 0;
  }
  sort(d.begin(), d.end());
  a = d[n - 1];
  vector<int> div;
  div.push_back(1);
  for (long long int i = 2; i * i <= a; i++) {
    if (a % i == 0) {
      div.push_back(i);
      if (i != (a / i)) div.push_back(a / i);
    }
  }
  if (a != 1) div.push_back(a);
  sort(div.begin(), div.end());
  int j = div.size() - 1, i;
  bool found = false;
  for (i = n - 1; i >= 0; i--) {
    if (j >= 0 && d[i] != div[j]) {
      found = true;
      break;
    } else
      j--;
  }
  if (found)
    b = d[i];
  else
    b = 1;
  cout << a << " " << b;
}
