#K13921. Finding the Most Logged Hours

    ID: 24020 Type: Default 1000ms 256MiB

Finding the Most Logged Hours

Finding the Most Logged Hours

You are given a log of work entries. Each entry contains an employee id, a project id, and the number of hours logged. Your task is to determine:

  • The project with the highest total logged hours.
  • The employee with the highest total logged hours.

In case of ties, output the project or employee that appears first when scanning the log entries sequentially.

Input Format: The first line contains an integer \( n \), the number of log entries. The next \( n \) lines each contain a string representing an employee id, a project id, and an integer representing the logged hours, separated by spaces.

Output Format: Print two space-separated strings: the id of the project with the most total logged hours and the id of the employee with the most total logged hours.

inputFormat

The input begins with an integer \( n \) representing the number of log entries.

Each of the following \( n \) lines contains an employee id (string), a project id (string), and the hours logged (integer), separated by spaces.

outputFormat

Output a single line containing two space-separated strings: first, the project id with the maximum logged hours, and second, the employee id with the maximum logged hours.

## sample
5
emp1 projA 4
emp2 projB 5
emp1 projA 3
emp3 projA 6
emp2 projB 2
projA emp1

</p>