#include <bits/stdc++.h>
using namespace std;
int occ[20000];
int main() {
  int count, a[200];
  cin >> count;
  for (int i = 0; i < count; ++i) {
    cin >> a[i];
  }
  int x = -1;
  for (int i = 0; i < count; ++i) {
    x = max(a[i], x);
  }
  for (int i = 0; i < count; ++i) {
    if (x % a[i] == 0 && occ[a[i]] == 0) {
      occ[a[i]] = 1;
      a[i] = 0;
    }
  }
  int y = -1;
  for (int i = 0; i < count; ++i) {
    y = max(a[i], y);
  }
  cout << x << " " << y << endl;
  return 0;
}
