Extreme Temperatures#9701

Extreme Temperatures

1 second
128 megabytes
Very easy

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 (1 \le n \le 1000) lines, each line (1 \le i \le n) being a space-separated list of k_i (2 \le k_i \le 100) tokens:

  • the first token is the date of the measurement, in the form YYYY-MM-DD;

  • for (2 \le j \le k_i), the -th entry is an integer temperature measurement t_{ij} (-50 \le t_{ij} \le 50).

Output

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

Examples

Example 1

Loading
Loading