#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > adj;
vector<int> vec;
set<int> st;
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
int n, ary[300000 + 5], d[300000 + 5];
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> ary[i];
  int x = *max_element(ary, ary + n), y;
  for (int i = 0; i < n; ++i) {
    if (x % ary[i] == 0 && d[ary[i]] == 0) {
      d[ary[i]] = 1;
      ary[i] = -1;
    }
  }
  y = *max_element(ary, ary + n);
  cout << x << " " << y;
  return 0;
}
