#K84482. Largest Square Plot

    ID: 36429 Type: Default 1000ms 256MiB

Largest Square Plot

Largest Square Plot

Given the dimensions of a garden represented by two integers m and n, you are required to determine the side length of the largest square plot that can be carved out from the garden. The side length of the square is limited by the smaller of the two dimensions. In mathematical terms, if you denote the side length as s, then

\( s = \min(m, n) \)

For example, if a garden has dimensions 6 and 4, the largest square that can be carved out will have a side length of 4.

inputFormat

The first line of input contains a single integer T representing the number of test cases. Each of the following T lines contains two space-separated integers m and n representing the dimensions of the garden.

Constraints:

  • 1 \( \leq T \leq 10^5 \)
  • 1 \( \leq m, n \leq 10^9 \)

outputFormat

For each test case, output a single integer representing the side length of the largest square plot that can be cut from the garden. Each output should be on a new line.

## sample
3
6 4
8 5
7 7
4

5 7

</p>