#include <bits/stdc++.h>
using namespace std;
int arr[130];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  int x, y;
  x = arr[n - 1];
  for (int i = n - 1; i > 0; i--) {
    if (arr[i] == arr[i - 1]) {
      y = arr[i - 1];
      break;
    } else if ((x % arr[i]) && (i != n - 1)) {
      y = arr[i];
      break;
    }
  }
  cout << x << " " << y << endl;
  return 0;
}
