#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, j = 0, p = 0;
  cin >> n;
  vector<long long> v1;
  for (long long i = 0; i < n; i++) {
    long long p;
    cin >> p;
    v1.push_back(p);
  };
  sort(v1.begin(), v1.end());
  for (long long i = 2; i < v1.size() - 1; i++) {
    if (v1[i] == v1[i + 1]) {
      j = i;
    };
  };
  long long a = v1[v1.size() - 1];
  for (long long i = j + 2; i < v1.size() - 1; i++) {
    if (a % v1[i] != 0) {
      p = i;
    };
  };
  if (p == 0) p = j;
  cout << a << " " << v1[p];
  return 0;
}
