#include <bits/stdc++.h>
int a[128];
int vis[10000];
using namespace std;
int main() {
  int q;
  cin >> q;
  for (int i = 1; i <= q; i++) {
    cin >> a[i];
  }
  sort(a, a + q + 1);
  int second = a[q];
  vis[a[q]] = 1;
  a[q] = 0;
  int first = 1;
  for (int i = 1; i < q; i++) {
    if (second % a[i] == 0 && vis[a[i]] == 0) {
      vis[a[i]] = 1;
      a[i] = 0;
    }
  }
  cout << endl;
  for (int i = q; i > 0; i--) {
    if (a[i] != 0) {
      first = a[i];
      break;
    }
  }
  cout << first << " " << second << endl;
  return 0;
}
