#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  long long n, max = 0;
  cin >> n;
  std::vector<long long> dp(10001, 0), a(n);
  for (long long i = 0; i < n; i++) {
    long long val;
    cin >> val;
    dp[val]++;
    a[i] = val;
    max = (val > max) ? val : max;
  }
  cout << max << " ";
  for (long long i = 1; i <= 10000; i++)
    if (max % i == 0) dp[i]--;
  max = 0;
  for (long long i = 1; i <= 10000; i++)
    if (dp[i] != 0) max = i;
  cout << max << endl;
  return 0;
}
