#include <iostream>
#include<cmath>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
int a, b, t,d,n;
while( cin >>n )
{
for(int i=0; i<=n; i++){
cin>>a>>b;
if(a==0 || b==0) return 0;
else{
d=a*b;
while( b!=0 )
{
t = b;
b = a%b;
a = t;
}
cout<<d/a<<endl;
}
}
}
return 0;
}
#include
#include
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char** argv) {
int a, b, t,d,n;
while( cin >>n )
{
for(int i=0; i<=n; i++){<------你寫i=0;i<=n;
cin>>a>>b;
if(a==0 || b==0) return 0;
else{
d=a*b;
while( b!=0 )
{
t = b;
b = a%b;
a = t;
}
cout<<d/a<<endl;
}
}
}
return 0;
}