#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long ar[n];
    for (long long(i) = (0); (i) < (n); (i)++) cin >> ar[i];
    sort(ar, ar + n);
    cout << ar[n - 1] << " ";
    for (long long(i) = n - 2; (i) >= (0); (i)--) {
      if (ar[n - 1] % ar[i] != 0 || ar[i + 1] == ar[i]) {
        cout << ar[i] << "\n";
        break;
      }
    }
  }
}
