#K90487. Hardest Worker Finder

    ID: 37763 Type: Default 1000ms 256MiB

Hardest Worker Finder

Hardest Worker Finder

You are given the number of employees and a list of work logs for these employees. Each work log contains an employee ID and the number of hours they worked. Your task is to determine the employee who worked the most hours and print both the employee ID and the number of hours worked.

Note: In the event of a tie (i.e. multiple employees worked the same maximum number of hours), select the employee with the smallest ID.

Hint: Use a simple iteration through the logs to keep track of the maximum hours and update the candidate based on the tie-breaking rule.

inputFormat

The first line of input contains two integers n and m where:

  • n is the number of employees.
  • m is the number of logs.

Each of the following m lines contains two space-separated integers: the employee ID and the number of hours worked.

outputFormat

Output a single line containing two space-separated integers: the employee ID who worked the most hours and the number of hours they worked. In case of a tie, the employee with the smallest ID should be printed.

## sample
1 1
1 100
1 100

</p>