In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].

If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.

<Submit a solution> [0/100]**Task statistics**

Number of users: 128

Number of users with 100 points: 91

Average result: 83.4609

# Solar Panels

### Memory limit: 128 MB

## Input

## Output

## Example

Number of users: 128

Number of users with 100 points: 91

Average result: 83.4609

Having decided to invest in renewable energy, Byteasar started a solar panels factory. It appears that he has hit the gold as within a few days clients walked through his door. Each client has ordered a single rectangular panel with specified width and height ranges.

The panels consist of square photovoltaic cells. The cells are available in all integer sizes, i.e., with the side length integer, but all cells in one panel have to be of the same size. The production process exhibits economies of scale in that the larger the cells that form it, the more efficient the panel. Thus, for each of the ordered panels, Byteasar would like to know the maximum side length of the cells it can be made of.

The first line of the standard input contains a single integer (): the number of panels that were ordered. The following lines describe each of those panels: the -th line contains four integers (, ), separated by single spaces; these specify the minimum width, the maximum width, the minimum height, and the maximum height of the -th panel respectively.

In tests worth of the total score, holds for each panel. In their subset worth of the total score, holds in addition.

Your program should print exactly lines to the standard output. The -th line is to give the maximum side length of the cells that the -th panel can be made of.

For the input data:

4 3 9 8 8 1 10 11 15 4 7 22 23 2 5 19 24

the correct result is:

8 7 2 5

**Explanation:** Byteasar will produce four solar panels of the following sizes:
(a single cell), (two cells), or
(22 or 33 cells respectively), and (four cells).

**Sample grading tests:**

`1ocen:`, , for each panel, the maximum side length of the cells it can be made of is exactly its .

*Task author: Bartosz Tarnawski.*