#include <iostream>
#include <algorithm>
using namespace std;
int main(void)
{
int t;
cin >> t;
while (t--)
{
int n1, n2, low = 1;
cin >> n1 >> n2;
for (int i = 2; i <= min(n1, n2); i++)
{
if (n1 % i == 0 && n2 % i == 0)
low = i;
}
cout << n2 / low * n1 << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKCWludCB0OwoJY2luID4+IHQ7CgoJd2hpbGUgKHQtLSkKCXsKCQlpbnQgbjEsIG4yLCBsb3cgPSAxOwoJCWNpbiA+PiBuMSA+PiBuMjsKCgkJZm9yIChpbnQgaSA9IDI7IGkgPD0gbWluKG4xLCBuMik7IGkrKykKCQl7CgkJCWlmIChuMSAlIGkgPT0gMCAmJiBuMiAlIGkgPT0gMCkKCQkJCWxvdyA9IGk7CgkJfQoJCWNvdXQgPDwgbjIgLyBsb3cgKiBuMSA8PCBlbmRsOwoJfQoJcmV0dXJuIDA7Cn0=