#C9861. Top Performing Sessions

    ID: 54001 Type: Default 1000ms 256MiB

Top Performing Sessions

Top Performing Sessions

You are given a series of sessions performed by various employees. Each session record contains an employee id and points scored during that session. The sessions are provided in chronological order and are numbered from 1 to m. Your task is to determine, for each distinct employee, the session id in which they achieved the highest points. In the event of a tie (i.e. equal points in multiple sessions), the earliest session (with the smaller session id) should be considered the top performing session.

Note: The result should be output for each employee in ascending order of employee id.

Example:

Input:
5
1 500
2 300
1 450
2 500
3 480

Output: 1 1 2 4 3 5

</p>

inputFormat

The input is read from standard input (stdin) and is structured as follows:

  • The first line contains a single integer m — the number of sessions.
  • Each of the next m lines contains two integers separated by a space: the employee id and the points scored during that session, respectively.

outputFormat

For each distinct employee (sorted in increasing order), print a line containing the employee id followed by the session id in which they achieved their highest points. The two numbers should be separated by a space. The output is written to standard output (stdout).

## sample
1
1 500
1 1

</p>