#include<iostream>
using namespace std;
ifstream fi("UCBC.inp");
ofstream fo("UCBC.out");
long int i;
long int a[10000],n;
void Nhap_Mang(long int a[],long int n)
{
	for (int i = 0; i < n; i++)
	{
		fi>> a[i];
	}
	return;
}
int UCLN(long int x,long int y)
{
	if (x < y)
	{
		for (int i = x; i >= 1; i--)
		{
			if (x % i == 0 && y % i == 0)
			{
				return i;
			}
		}
	}
	else
	{
		for (int i = y; i >= 1; i--)
		{
			if (x % i == 0 && y % i == 0)
			{
				return i;
			}
		}
	}
}
long int BCNN(long int x,long int y)
{
    long int z=x/UCLN(x,y)*y;
}
long int UCLN_Cua_Mang(long int a[],long int n)
{
	long int x = a[0];
	for (long int i = 1; i < n; i++)
	{
		x = UCLN(x, a[i]);
	}
	return x;
}
long int BCNN_Cua_Mang(long int a[],long int n)
{
    long int x = a[0];
	for (long int i = 1; i < n; i++)
	{
		x = BCNN(x, a[i]);
	}
	return x;
}
int main()
{
	do
	{
		cin >> n;

	} while (n <= 0 || n > 100);
	Nhap_Mang(a, n);
	fo<< UCLN_Cua_Mang(a, n)<<endl<<BCNN_Cua_Mang(a,n);
	return 0;
}
