eolymp
bolt
Try our new interface for solving problems
Problems

Warm-up

Warm-up

Find a pair of numbers, according to a specified output criteria. \InputFile In the input file is written first, the number \textbf{N} (\textbf{1} ≤ \textbf{N} ≤ \textbf{100}), and then the \textbf{N} pairs of numbers. The first number in each pair - a natural, not exceeding \textbf{30000}. The second number of each pair - either \textbf{0} or \textbf{1}. \OutputFile Required to find and display the output file number of the pair, in which the second number is equal to \textbf{1}, and from all such pairs one in which the first number of the most (if several such pairs, display the first of them). If the pairs for which the second number is equal to \textbf{1} no, output in the output \textbf{-1}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
4
25 1
70 1
100 0
3 1
Output example #1
2