#include <bits/stdc++.h>
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const long double epsilon = 1e-15;
static const long double pi = acos((long double)-1);
using namespace std;
inline void init_io() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
const int N = 200001;
int arr[N];
int main() {
  init_io();
  int n;
  cin >> n;
  int maxi = -1;
  int b = -1;
  map<int, int> m;
  for (int(i) = (0); (i) < (n); i++) {
    cin >> arr[i];
    maxi = max(maxi, arr[i]);
  }
  for (int(i) = (0); (i) < (n); i++)
    if (maxi % arr[i] == 0) m[arr[i]]++;
  for (int(i) = (0); (i) < (n); i++) {
    if (m.find(arr[i]) == m.end() || m[arr[i]] == 2) b = max(b, arr[i]);
  }
  cout << maxi << " " << b << '\n';
  return 0;
}
