#C8019. Highest Priority Incomplete Project

    ID: 51955 Type: Default 1000ms 256MiB

Highest Priority Incomplete Project

Highest Priority Incomplete Project

You are given a list of projects, each with a priority level and a completion percentage. A project is considered incomplete if its completion percentage is less than 100. Your task is to determine the project with the highest priority among those that are incomplete. If multiple projects have the same highest priority, choose the one with the highest completion percentage. If all projects are complete, output (-1).

The input begins with an integer (n) (the number of projects), followed by (n) lines, each containing two integers representing the project's priority and its completion percentage.

inputFormat

The first line contains an integer (n) (the number of projects). Each of the following (n) lines contains two space-separated integers: the priority and the completion percentage of a project.

outputFormat

Print a single integer: the priority of the highest priority incomplete project. If every project is complete (i.e. completion percentage is 100), output (-1).## sample

3
50 100
80 90
30 20
80