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