#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n + 5];
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  int x = arr[n - 1];
  int y = 0;
  for (int i = n - 2; i > 0; i--) {
    if (x % arr[i] != 0) {
      y = arr[i];
      break;
    }
    if (arr[i] == arr[i + 1]) {
      y = arr[i + 1];
      break;
    }
  }
  if (y == 0) y = 1;
  cout << x << " " << y << endl;
}
