#include <bits/stdc++.h>
using namespace std;
int arr[130];
bool cek[130];
int main() {
  int n;
  cin >> n;
  int maxx;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  maxx = arr[n - 1];
  for (int i = 1; i * i <= maxx; i++) {
    if (maxx % i == 0) {
      cek[lower_bound(arr, arr + n, i) - arr] = 1;
      cek[lower_bound(arr, arr + n, maxx / i) - arr] = 1;
    }
  }
  int hsl2 = -1;
  for (int i = 0; i < n; i++) {
    if (!cek[i]) {
      hsl2 = max(hsl2, arr[i]);
    }
  }
  cout << maxx << " " << hsl2 << endl;
}
