e-olymp
favorite We need a little bit of your help to keep things running, click on this banner to learn more
Competitions

April 25 - ADA Contest

Extreme Temperatures

Kristen is a meteorologist, who is monitoring extreme temperatures in the forest of Palaiseau. She has collected temperature measurements at various times over several days. Help her find out what the lowest and highest temperatures were in her entire dataset.

Input

The input is formed of n (1n1000) lines, each line i (1in) being a space-separated list of ki (2ki100) tokens:

  • the first token is the date of the measurement, in the form YYYY-MM-DD;
  • for j (2jki), the j-th entry is an integer temperature measurement tij (-50tij50).

Output

The output should contain a single line with two integers: the lowest and highest temperatures in the entire dataset, in this order.

Time limit 1 second
Memory limit 128 MiB
Input example #1
2020-01-15 5 4 6 8 12 13 12 9 7
2020-01-16 6 3 4 6 10 12 11 7
Output example #1
3 13
Source 2019 ACM Southwestern Europe Regional Contest (SWERC), Paris, Practice Contest, January 25 (2020), Problem E