#include <iostream>
#include <string.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#define ll long long//是ll在前面
using namespace std;
void gcd(ll a,ll b)//记得全部都要用ll
{
ll t=0,x=a,y=b;//这里要先保存a,b数据
while(x%y!=0)//这里记得用while
{
t=x%y;
x=y;
y=t;
}
cout<<a*b/y<<endl;
}
int main()
{
ll m;
cin>>m;
ll a,b;
while(m--)
{
cin>>a>>b;
gcd(a,b);
}
cout<<"group 1 done"<<endl;
while(cin>>a>>b&&a&&b)
gcd(a,b);
cout<<"group 2 done"<<endl;
while(cin>>a>>b)
gcd(a,b);
cout<<"group 3 done"<<endl;
return 0;
}