#include <fstream>
#include <math.h>

using namespace std;

int GCD(int a, int b)
{
	return (b == 0) ? a : GCD(b, a % b);
}

int LCM(int a, int b)
{
	return a * b / GCD(a, b);
}

int main()
{
	ifstream input("UCBC.inp");
	ofstream output("UCBC.out");

	int n;
	input >> n;
	int UC = 0, BC = 1;
	int a;
	for (int i = 0; i < n; i++)
	{
		input >> a;
		UC = GCD(abs(a), UC);
		BC = LCM(abs(a), BC);
	}
	output << UC << '\n' << BC;
	input.close();
	output.close();
	return 0;
}