#include <cstdio>
#include <iostream>
using namespace std;
//最小公倍数=两整数的乘积÷最大公约数
//辗转相除法求最大公约数(枚举法会超时)
//因为题目输入的数最大为2的31次方,故要用long long
long long Bei(long long a,long long b)
{
long long c,p = a,q = b;
while(a % b != 0){
c = a % b;
a = b;
b = c;
}
return (p * q) / b; //b为最大公约数
}
int main()
{
int n,a,b;
scanf("%ld",&n);
//第一组多case情况,直接n自减
while(n--){
cin >> a >> b;
cout << Bei(a,b) << endl;
}
cout << "group 1 done" << endl;
//第二种多case情况,添加以a!=0 && b!=0为判断条件
while(cin >> a >> b && a != 0 && b!= 0){
cout << Bei(a,b) << endl;
}
cout << "group 2 done" << endl;
//第三种无标志多case,想要结束时在命令窗口ctrl+z即可结束,相当于输入cin>>a>>b=EOF
while(cin >> a >> b){
cout << Bei(a,b) << endl;
}
cout << "group 3 done" << endl;
return 0;
}