Problem: Santosh has a farm at Byteland. He has a very big family to look after.  His life takes a sudden turn and he runs into a financial crisis. After giving all the money he has in his hand, he decides to sell some parts of his plots. The specialty of his plot is that it is rectangular in nature. Santosh comes to know that he will get more money if he sells square shaped plots. So keeping this in mind, he decides to divide his plot into minimum possible square plots so that he can get maximum profit out of this.
So your task is to find the minimum number of square plots that can be formed out of the rectangular plot.

Input

The input consists of T number of test cases. T lines follow. Each line consists of two integers N and M which denotes the length and breadth of the rectangle.


Output
Output is a single line which denotes the minimum number of square plots that can be formed

Constraints

1<=T<=20 
1<=M<=10000 
1<=N<=10000 

Input:
2
10 15
4 6

Output:
6
6

Solution (in PYTHON):

Solution:
def main():
	n=input()
	lt=[]
	for i in range(n):
		a,b=raw_input().split()
		a,b=int(a),int(b)
		d=gcd(a,b)
		if(a%d==0 and b%d==0):
			lt.append((a*b)/(d*d))
		else:
			lt.append(a*b)
	for i in range(n):
		print lt[i]
'''
def gcd(a, b):
	if(a>b):
		mi=b
		ma=a
	else:
		mi=a
		ma=b
	print mi,ma
	if(ma%mi==0):
		#print mi
		return mi
	else:
		gcd(mi,ma%mi)

'''

def gcd(a, b):
    """Calculate the Greatest Common Divisor of a and b.

    Unless b==0, the result will have the same sign as b (so that when
    b is divided by it, the result comes out positive).
    """
    while b:
        a, b = b, a%b
    return a

if __name__ == '__main__':
	main()