#include <bits/stdc++.h>
using namespace std;
multiset<int> v;
int getMin(int a, int b) { return a > b ? b : a; }
int main() {
  ios::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  int n;
  cin >> n;
  int max = 0;
  for (int i = 0; i < n; i++) {
    int num;
    cin >> num;
    v.insert(num);
    if (max < num) max = num;
  }
  cout << max << " ";
  for (int i = 1; i * i <= max; i++) {
    if (max % i == 0) {
      if (i * i != max) {
        v.erase(v.find(i));
        v.erase(v.find(max / i));
      } else {
        v.erase(v.find(i));
      }
    }
  }
  cout << *max_element(v.begin(), v.end());
  return 0;
}
