#include<iostream>
using namespace std;
//求最大公约数
int gcd1(int a,int b)
{
int t;
while(b!=0)
{
t = a%b;
a = b;
b = t;
}
return a;
}
int gcd2(int a,int b)
{
if(b==0)
{
return a;
}
else
{
gcd(b,a%b);
}
}
int gcd3(int a,int b)
{
return b==0? a:gcd(b,a%b);
}
//求最小公倍数
int lcm(int a,int b)
{
return a*b/gcd1(a,b);
}
int main()
{
int t,n,m,c,max,min;
cin>>t;
for(int i=0;i<t;++i)
{
cin>>n>>m;
max = n>m ? n:m;
min = n<m ? n:m;
cout<<lcm(max,min)<<endl;
}
return 0;
}