#C1867. Largest Square from Canvas

    ID: 45119 Type: Default 1000ms 256MiB

Largest Square from Canvas

Largest Square from Canvas

You are given a number of canvases, each described by its width (w) and height (h). For each canvas, determine the side length of the largest square that can be cut from it, which is (\min(w, h)).

For example, if a canvas has dimensions 4 and 5, then the largest square that can be cut out will have a side length of 4.

inputFormat

The input begins with an integer (t) representing the number of canvases. This is followed by (t) lines, each containing two integers (w) and (h) (separated by a space) indicating the width and height of a canvas.

outputFormat

Output a single line with (t) integers. Each integer represents the side length of the largest possible square for the corresponding canvas. The integers should be separated by a single space.## sample

3
4 5
8 3
6 6
4 3 6