#include <bits/stdc++.h>
using namespace std;
void cal_div(int n, vector<int> &resp) {
  int i = 1;
  while (i * i < n) {
    if (!(n % i)) {
      resp.push_back(i), resp.push_back(n / i);
    }
    ++i;
  }
  if (n == i * i) {
    resp.push_back(i);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> numbers(n);
  for (int &num : numbers) {
    cin >> num;
  }
  sort(numbers.begin(), numbers.end());
  int x = numbers.back();
  vector<int> divx(0);
  cal_div(x, divx);
  for (int div : divx) {
    for (int i = 0; i < (int)numbers.size(); ++i) {
      if (div == numbers[i]) {
        swap(numbers[i], numbers.back());
        numbers.pop_back();
        break;
      }
    }
  }
  sort(numbers.begin(), numbers.end());
  cout << x << " " << numbers.back() << "\n";
  return 0;
}
