#include <bits/stdc++.h>
using namespace std;
int n, d[129], mp[10001], u[10001];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> d[i];
    mp[d[i]]++;
  }
  sort(d + 1, d + 1 + n);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (d[j] % d[i] == 0 && d[j] != d[i]) {
        u[i] = 1;
        break;
      }
    }
  }
  int cnt = 2, j;
  for (int i = n; i >= 1; --i) {
    if (cnt == 0) {
      return 0;
    }
    if (!u[i]) {
      cout << d[i] << endl;
      cnt--;
      j = i;
    }
  }
  if (cnt == 1) {
    for (int i = n; i >= 1; --i) {
      if (i != j) {
        if (mp[d[i]] > 1) {
          cout << d[i];
          return 0;
        }
      }
    }
    cout << d[1];
    return 0;
  }
}
