import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st;
int num = Integer.parseInt(bf.readLine());
for (int i = 0; i<num; i++) {
st = new StringTokenizer(bf.readLine());
int A = Integer.parseInt(st.nextToken());
int B = Integer.parseInt(st.nextToken());
System.out.println(A * B / solve(A, B));
}
}
static int solve(int A, int B) {
int R = 0;
while (B != 0) {
R = A % B;
A = B;
B = R;
}
return A;
}
}
GCD방법으로 간단하게 풀 수 있었다.