#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
int main() {
  scanf("%d", &n);
  vector<int> v;
  map<int, int> map1;
  for (int i = 0; i < n; ++i) {
    int n1;
    cin >> n1;
    v.push_back(n1);
    map1[n1]++;
  }
  int num1 = *max_element(v.begin(), v.end());
  int num2 = 1;
  set<int> set1;
  for (auto elem : map1) {
    if (num1 % elem.first == 0) {
      if (elem.second == 2) {
        set1.insert(elem.first);
      }
    } else {
      set1.insert(elem.first);
    }
  }
  printf("%d %d\n", num1, *set1.rbegin());
}
