#include <iostream>
using namespace std;
int gcd(int a, int b)
{
int r = a % b;
if (r == 0)
return b;
return gcd(b, r);
}
int main(void)
{
int T, A, B, temp, answer;
cin >> T;
for (int i = 0; i < T; i++)
{
cin >> A >> B;
if (A >= B)
temp = gcd(A, B);
else
temp = gcd(B, A);
answer = A * B / temp;
cout << answer << endl;
}
}
Coding/BaekJoon