## LCC '21 Contest 3 J4 - A Chemistry Problem

View as PDF

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

After finishing his chemistry lab early, David is experimenting with a mysterious solution that his teacher gave him.

In particular, David wants to find the number of hydronium ions in the solution, which he knows to be a positive integer. To do so, he has asked his teacher for acid-base indicators to test the solution with. While conducting the experiments, the th indicator tells David with certainty that the number is between and , inclusive.

David would like you to figure out the minimum and maximum possible number of hydronium ions the solution can have, or that no number works because someone has mislabeled the indicators.

#### Input Specifications

The first line will contain an integer, .

The next lines will each contain two space-separated integers, and .

#### Output Specifications

Output one line containing two space-separated integers, the minimum and maximum possible number of hydronium ions the solution can have. If there are no possible numbers, output -1 instead.

#### Sample Input

2
1 6
2 6

#### Sample Output

2 6