#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    v.push_back(num);
  }
  sort(v.begin(), v.end());
  int a = v.back();
  v.pop_back();
  for (int i = 0; i < v.size(); i++) {
    if (v[i] == v[i + 1]) i++;
    if (a % v[i] == 0) v[i] = 0;
  }
  sort(v.begin(), v.end());
  int b = v.back();
  cout << a << " " << b << endl;
  return 0;
}
