You are given a rectangle whose side lengths are integers. Cut it into squares whose side lengths are also integers. The squares do not overlap, together they cover the whole rectangle with no gap, and every side of every square is parallel to a side of the rectangle.
Find the smallest number of squares such a cut can use.
Input
The first line contains the number of test cases T (1≤T≤625).
Each of the next T lines contains two integers wi and hi, the side lengths of one rectangle (1≤wi,hi≤25).
No two test cases have the same pair of side lengths. That is, if i=j, then wi=wj or hi=hj.
Output
For each test case, print the minimum number of squares needed to cut the wi×hi rectangle. Print one number per line, in the order the test cases are given. Do not print the cut itself.
Hint
A 5×3 rectangle splits into squares of side 3, 2, 1 and 1, so 4 squares are enough.
A 5×6 rectangle splits into three squares of side 2 and two squares of side 3. Cutting off a square of side 5 first leaves a 5×1 strip and costs 6 squares, so taking the largest square first is not always best.