#include<fstream>
using namespace std;
ifstream fi("UCBC.inp");
ofstream fo("UCBC.out");
long long a[10000],n;
long long ucln(long long a, long long b)
{
    while (b > 0)
    {
        long long r = a%b;
        a = b; b = r;
    }
    return a;
}
long long bcnn(long long a, long long b)
{
    return a*b / ucln(a,b);
}
int main()
{
	fi >> n;
	fi >> a[0];
    long long uc = a[0],bc = a[0];
	for (int i = 1; i < n; i++)
    {
        fi >> a[i];
        uc = ucln(uc,a[i]);
        bc = bcnn(bc,a[i]);
    }
    fo << uc << endl << bc;
	return 0;
}
