#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int n;
vector<int> vc, f, s;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    vc.push_back(d);
  }
  sort(vc.begin(), vc.end());
  int y = vc[vc.size() - 1];
  int x;
  for (int i = vc.size() - 2; i >= 0; i--) {
    if (y % vc[i] != 0 || vc[i] == vc[i + 1]) {
      cout << y << " " << vc[i] << endl;
      return 0;
    }
  }
  return 0;
}
