#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int N;
  cin >> N;
  vector<int> vi(N);
  multiset<int> ms;
  for (int i = 0; i < N; i++) {
    cin >> vi[i];
    ms.insert(vi[i]);
  }
  int MAX = *max_element(ms.begin(), ms.end());
  cout << MAX << " ";
  for (int i = 1; i <= MAX; i++) {
    if (MAX % i == 0) ms.erase(ms.find(i));
  }
  cout << *max_element(ms.begin(), ms.end()) << "\n";
}
