#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, a;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  sort(v.begin(), v.end());
  int x = v[n - 1];
  for (int i = 1; i <= x; i++) {
    if (x % i == 0) {
      v.erase(find(v.begin(), v.end(), i));
    }
  }
  int y = v[v.size() - 1];
  cout << x << " " << y;
  cout << endl;
  return 0;
}
