#C7404. Highest Priority and Fastest Task Selection

    ID: 51272 Type: Default 1000ms 256MiB

Highest Priority and Fastest Task Selection

Highest Priority and Fastest Task Selection

You are given several projects. Each project has a list of tasks, where each task is represented by a description, a priority, and the time required to complete it.

For each project, your goal is to select the task(s) having the highest priority. If there is more than one task with the highest priority, then among these, choose the task(s) that require the least time to complete. If there are multiple tasks meeting both criteria, output all of them in the order they appear in the input.

Note: Higher integer value for priority means a more important task.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains an integer \(P\) representing the number of projects.
  2. For each project, the first line contains an integer \(N\) representing the number of tasks in that project.
  3. Then \(N\) lines follow, each line representing a task in the format: description,priority,time. The description is a string without commas, while priority and time are integers.

outputFormat

For each selected task from each project, print a line to standard output (stdout) with the task's description, priority, and time separated by a single space, preserving the order of the projects as given in the input. If a project has multiple tasks satisfying the conditions, print each on a separate line in the order they appear in the input.

## sample
1
3
Fix_bugs,8,30
Develop_feature,9,45
Optimize_code,9,30
Optimize_code 9 30

</p>