Олимпиадный тренинг

Задача 39815. DV-2022


Trees are being planted in the forest belt. Moreover, seedlings are planted in rows at the same distance.
After some time, aerial photography is carried out, as a result of which it is determined which seedlings have taken root. It is necessary to determine the row with the maximum number, in which there are at least 11 non-rooted seedlings in a row, provided that the seedlings have taken root to the right and left of them.
In your answer, first write down the largest number of the row, then the smallest number of the unattached places.

Input
The first line of the input file contains the number N - the number of established seedlings (a natural number not exceeding 10,000). Each of the following N lines contains two natural numbers not exceeding 100,000: the number of the row and the number of the place where the seedlings have taken root.

Imprint
Two non-negative integers: the largest number of the row, then the smallest number of the unattached places.

Example input file

7
40 30
40 34
50 125
50 129
50 64
50 68
50 70

An example answer (when searching for 3 non-rooted seedlings in a row):
50 65

File for the task