
1. Square is a quadrilateral whose all four sides are of equal length.
2. If the given paper is already a square then it is possible to cut the whole square in one move.
The first line of the input contains an integer T, denoting the number of test cases.
The first line of each test case consists of two space-separated integers N and M denoting the dimensions of the given paper, in a separate line.
For each test case return, the minimum number of squares in which you can cut the given paper.
You don't have to print anything, it has already been taken care of. Just Implement the given function.
1<= T <= 50
1<= N, M <= 150
Time Limit: 1 sec.
Eg. For paper with dimension (2, 3), the algorithm will work as follows: