#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, max = 0, j = 0, b, f = 0, k;
  cin >> n;
  long long int a[n][2];
  for (i = 0; i < n; i++) a[i][1] = 0;
  for (i = 0; i < n; i++) {
    f = 0;
    cin >> b;
    if (max < b) max = b;
    if (i == 0) {
      a[j][0] = b;
      a[j][1]++;
      j++;
    } else {
      for (k = 0; k <= j; k++) {
        if (b == a[k][0]) {
          f = 1;
          break;
        }
      }
      if (f == 1)
        a[k][1]++;
      else {
        a[j][0] = b;
        a[j][1]++;
        j++;
      }
    }
  }
  cout << max << " ";
  for (i = 0; i < j; i++) {
    if (max % a[i][0] == 0) a[i][1]--;
  }
  max = 0;
  for (i = 0; i < j; i++) {
    if (a[i][1] != 0) {
      if (max < a[i][0]) max = a[i][0];
    }
  }
  cout << max << endl;
  return 0;
}
