def nwd(n, k):
x=0
while k !=0:
x=n%k
n, k=k , x
return n
def nww(n ,k):
return n*k // nwd(n, k)
t=int(input())
for i in range(t):
linijka = input().split()
linijka[0]=int(linijka[0])
linijka[1]=int(linijka[1])
print (nww(linijka[0],linijka[1]))
ZGVmIG53ZChuLCBrKToKCXg9MAoJd2hpbGUgayAhPTA6CgkJeD1uJWsKCQluLCBrPWsgLCB4CglyZXR1cm4gbgpkZWYgbnd3KG4gLGspOgoJcmV0dXJuIG4qayAvLyBud2QobiwgaykKCgp0PWludChpbnB1dCgpKQpmb3IgaSBpbiByYW5nZSh0KToKCWxpbmlqa2EgPSBpbnB1dCgpLnNwbGl0KCkKCWxpbmlqa2FbMF09aW50KGxpbmlqa2FbMF0pCglsaW5pamthWzFdPWludChsaW5pamthWzFdKQoJcHJpbnQgKG53dyhsaW5pamthWzBdLGxpbmlqa2FbMV0pKQoJCgo=