#include <bits/stdc++.h>
using namespace std;
const int N = 130;
int n, l[N], m, M;
map<int, int> s;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> l[i];
  M = *max_element(l, l + n);
  for (int i = 0; i < n; ++i) {
    if (!(M % l[i])) {
      if (s[l[i]]) m = max(l[i], m);
      s[l[i]]++;
    } else
      m = max(l[i], m);
  }
  cout << M << " " << m;
}
