#include<stdio.h>
int max(int a,int b)
{
	if(a>b)return a;
	else return b;
#define ll long long
ll gcd(ll a,ll b)
{
return b?gcd(b,a%b):a;
}
ll lcm(ll a,ll b)
{
return a/gcd(a,b)*b;
}
int main()
{
	ll str[107];
	char s;
	ll  i,j,m,n,a,b,sum;
while(scanf("%d",&n))
{getchar();
while(n--){ sum=0; while(1){
            scanf("%c",&s);
            if(s=='\n')
            break;
            if(s>='0'&&s<='9')
            sum=sum*10+s-'0';
            else
            {
                if(sum==0)
                continue;
                if(sum!=0)
                str[m++]=sum;
                sum=0;}}
ll maxx=1;
for(i=0;i<m;i++)
maxx=lcm(maxx,str[i]);
printf("%lld\n",maxx);
}}return 0;
}