A. Favorite Foods
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Francesca is compiling a list of her favorite (and least favorite) foods to help with meal planning. She gives an integer rating for each of $$$n$$$ different foods, where a higher rating indicates that Francesca likes the food more. Obviously, Francesca would prefer to prepare foods with a high rating more often and prepare foods with a low rating less often.

Given the list of foods and ratings Francesca has given for each food, figure out Francesca's least favorite food (food with the lowest rating) and her favorite food (food with the highest rating). It is guaranteed that each food rating will be distinct and the same food will not appear multiple times on Francesca's list.

Input

The first line of the input consists of a single integer $$$n$$$ $$$(1 \leq n \leq 50)$$$, giving the number of foods that Francesca has given a rating for. The next $$$n$$$ lines each consist of a single token food name $$$f_i$$$ $$$(1 \leq |f_i| \leq 30)$$$ and a rating $$$r_i$$$ associated with that food $$$(-10^9 \leq r_i \leq 10^9)$$$. $$$f_i$$$ will always consist of only uppercase and lowercase letters.

Output

Output Francesca's least favorite food and favorite food, separated by a space.

Example
Input
3
Sandwiches 23
Sardines -2
Pizza 23984
Output
Sardines Pizza