#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n);
  for (size_t i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<int>());
  int x = a[0], y = 0;
  for (size_t i = 0; i < n - 1; i++) {
    if (x % a[i] != 0 || a[i] == a[i + 1]) {
      y = a[i];
      break;
    }
  }
  cout << x << " " << y;
}
