#C11043. Largest Square in a Field
Largest Square in a Field
Largest Square in a Field
You are given several rectangular fields, each with dimensions L and W. Your task is to determine the side length of the largest square that can tile the entire field without any leftover area. This side length is exactly the greatest common divisor (GCD) of L and W.
Recall that mathematically the GCD of L and W is given by:
$$\gcd(L, W)$$
Please note that the dimensions provided will be positive integers. The input follows the format as described below.
inputFormat
The first line contains a single integer T representing the number of test cases. Each of the next T lines contains two space-separated positive integers L and W, representing the length and width of a field.
outputFormat
For each test case, output a single line containing the side length of the largest square that can perfectly tile the field.
## sample2
15 20
8 12
5
4
</p>