#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING

#include <bits/stdc++.h>

using namespace std;


int a[129] = {0};
multiset<int> s;

int main() {
    s.clear();
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        s.insert(a[i]);
    }
    int x = *s.rbegin();
    multiset<int>::iterator ite;
    for (int i = 1; i <= x; i++)
        if (x % i == 0) {
            ite = s.find(i);
            if (ite != s.end())
                s.erase(ite);
        }
    cout << *s.rbegin() << " " << x;
    return 0;
}
