#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using llu = unsigned long long;
ll mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t, n, m, i, j, k;
  cin >> n;
  ll a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  k = a[n - 1];
  cout << k << " ";
  ll z[100000] = {0};
  for (i = 1; i <= k; i++) {
    if (k % i == 0) {
      z[i] = 1;
    }
  }
  ll ans = 1;
  for (i = 0; i < n; i++) {
    if (z[a[i]] >= 1)
      z[a[i]] = 0;
    else
      ans = max(ans, a[i]);
  }
  cout << ans;
}
