#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int str[200];
  int arr[200];
  while (cin >> n) {
    memset(str, 0, sizeof(str));
    memset(arr, 0, sizeof(arr));
    int k = 0;
    for (int i = 0; i < n; i++) {
      cin >> str[i];
    }
    sort(str, str + n);
    for (int i = 0; i < n; i++) {
      if (str[n - 1] % str[i] == 0 && str[i] == str[i + 1]) {
        arr[k++] = str[i + 1];
      } else if (str[n - 1] % str[i] != 0) {
        arr[k++] = str[i];
      }
    }
    cout << str[n - 1] << " " << arr[k - 1] << endl;
  }
  return 0;
}
