#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
const long double pi = 3.141592;
const long long mod1 = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  int n;
  cin >> n;
  vector<int> d(n + 1);
  set<int> set;
  int x = 1, y = 1;
  int m = 1;
  for (int i = 1; i <= n; i++) {
    cin >> d[i];
    m = max(m, d[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (m % d[i] == 0 && set.find(d[i]) == set.end()) {
      set.insert(d[i]);
      d[i] = -1;
    }
  }
  for (int i = 1; i <= n; i++) {
    y = max(y, d[i]);
  }
  cout << m << " " << y;
  return 0;
}
