#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long dx[4] = {-1, 1, 0, 0};
const long long dy[4] = {0, 0, -1, 1};
const long long MAX = 1e5 + 10;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long n, m, x, y, k, Q, ans;
string second, t;
bool took[MAX];
vector<int> v;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> x, v.push_back(x);
  sort(v.begin(), v.end());
  y = v[n - 1];
  took[y] = true;
  x = 1;
  for (int i = n - 2; i >= 0; --i)
    if (y % v[i] == 0 && !took[v[i]])
      took[v[i]] = true;
    else if (x % v[i])
      x *= v[i];
  cout << x << ' ' << y << '\n';
  return 0;
}
