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