#K71472. Task Scheduling Based on Priority and Time

    ID: 33539 Type: Default 1000ms 256MiB

Task Scheduling Based on Priority and Time

Task Scheduling Based on Priority and Time

You are given a list of tasks, each with a name, a required time, and a priority. Your objective is to schedule these tasks by sorting them primarily by their priority (in ascending order) and secondarily by their required time (in ascending order). If two tasks have the same priority and required time, maintain the relative order in which they were given.

The sorting criterion can be formally defined as: \( \text{Sort key} = (\text{priority},\, \text{required time}) \).

inputFormat

The first line contains an integer \( n \) representing the number of tasks. Each of the next \( n \) lines contains a task description with three values separated by spaces: the task name (a string), the required time (an integer), and the priority (an integer).

outputFormat

Output the sorted list of tasks. Each task should be printed on a new line in the format: task name, required time, and priority separated by a space.

## sample
5
TaskA 30 1
TaskB 20 2
TaskC 10 1
TaskD 40 3
TaskE 10 2
TaskC 10 1

TaskA 30 1 TaskE 10 2 TaskB 20 2 TaskD 40 3

</p>