PROGRAMMING:Big Event
We all know that the major of computer science and Technology (Sino foreign cooperation) was divided into computer science and technology and computer science and Technology (Sino foreign cooperation) in 2017. At the same time, all facilities have to be halved. First, all facilities are evaluated. If two facilities have the same value, they are considered to be the same. Suppose there are n (0 < n < 1000) kinds of facilities (different values, different types).
###Input format:
The input contains multiple test cases. Each test case starts with n (0 < n < = 50), indicating the number of facility types. Then there are n lines. Each line contains an integer V (0 < V < 50) and an integer m (0 < m < 100) to represent the unit price and quantity of facilities respectively. You can assume that all V's are different.
The input is terminated by - 1, and the test case is not processed.
###Output format:
For each case, the printed line contains two integers a and B, representing the value of the facilities allocated by the two specialties. A and B should be as equal as possible. At the same time, you should make sure that a is not less than B.
###Input example:
```in
two
10 1
20 1
three
10 1
20 2
30 1
-1
```
###Output example:
```out
20 10
40 40
```
answer:If there is no answer, please comment
###Input format:
The input contains multiple test cases. Each test case starts with n (0 < n < = 50), indicating the number of facility types. Then there are n lines. Each line contains an integer V (0 < V < 50) and an integer m (0 < m < 100) to represent the unit price and quantity of facilities respectively. You can assume that all V's are different.
The input is terminated by - 1, and the test case is not processed.
###Output format:
For each case, the printed line contains two integers a and B, representing the value of the facilities allocated by the two specialties. A and B should be as equal as possible. At the same time, you should make sure that a is not less than B.
###Input example:
```in
two
10 1
20 1
three
10 1
20 2
30 1
-1
```
###Output example:
```out
20 10
40 40
```
answer:If there is no answer, please comment