#include <bits/stdc++.h>
using namespace std;
string s;
int n,b,d,c=1,p=1,tu1,k,h,tu2,mau1,mau2,a[10000000],f1,f2,f3,mauchung,tuchung;
int ucln(int a,int b)
{
    int r;
    while (b!=0)
    {
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
int ahihi(int a[],int n,int i,int &m)
{
    if (i>0&i<n)
    {
        if (i==1)
        {
            m=a[i-1];
        }
        m=ucln(a[i],m);
        i++;
        ahihi(a,n,i,m);
    }
    else
        return m;
}
int ahihi2(int a[],int n,int i,int &m)
{
    if (i>0&&i<n)
    {
        if (i==1)
        {
            m=a[i-1];
        }
        m=m*a[i]/ucln(m,a[i]);
        i++;
        ahihi2(a,n,i,m);
    }
    else
    {
        return m;
    }
}
int main()
{
    freopen("UCBC.inp","r",stdin);
    freopen("UCBC.out","w",stdout);
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ahihi(a,n,p,b);
    cout<<b<<endl;
    ahihi2(a,n,p,f1);
    cout<<f1<<endl;
}

