#include <bits/stdc++.h>
const long long int mod = 1000000007;
using namespace std;
void toh_chaliye_shuru_karte_hain() {}
void code_samapti_ki_ghoshna() {}
long long int power(long long int a, long long int b, long long int modi) {
  a %= modi;
  long long int res = 1;
  while (b) {
    if (b % 2) {
      res = (res * a) % modi;
    }
    b /= 2;
    a = (a * a) % modi;
  }
  return res;
}
int main() {
  toh_chaliye_shuru_karte_hain();
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  long long int i, flag = 0, x, y;
  multiset<long long int> s;
  for (i = 0; i < n; i++) {
    cin >> x;
    s.insert(x);
  }
  y = *prev(s.end());
  for (i = 1; i <= y; i++) {
    if (y % i == 0) {
      s.erase(s.find(i));
    }
  }
  cout << y << " ";
  cout << *prev(s.end()) << "\n";
  code_samapti_ki_ghoshna();
  return 0;
}
