math패키지를 사용하여 최소공배수를 간단하게 구할 수 있었다.
import sys import math n = int(input()) for _ in range(n): a, b = map(int, sys.stdin.readline().strip().split()) print(math.lcm(a, b))