Task management system with priorities

Go Medium structs

Task «Task management system with priorities»

Develop a program for managing a task list. Each task is described by a Task structure with fields: ID (int), Title (string), Priority (int), and Status (string). The program should read the number of tasks, then the tasks themselves. After that, it should output all tasks sorted by priority (ascending), and for tasks with the same priority — by ID (ascending). Output each task in the format: ID: Title [Priority] - Status.

Input Format

First line: integer N (1 ≤ N ≤ 100) — the number of tasks. Then each of the N lines contains: ID (integer), Title (string without spaces), Priority (integer), Status (string without spaces), separated by a space.

Output Format

N lines, each in the format: ID: Title [Priority] - Status. The lines are sorted by priority (ascending), and for equal priority — by ID (ascending).

Examples

Example 1

INPUT
3 1 TaskA 2 Active 2 TaskB 1 Completed 3 TaskC 2 Pending
OUTPUT
2: TaskB [1] - Completed 1: TaskA [2] - Active 3: TaskC [2] - Pending

Example 2

INPUT
listen silent
OUTPUT
YES

Example 3

INPUT
2 101 Alpha 5 High 102 Beta 3 Low
OUTPUT
102: Beta [3] - Low 101: Alpha [5] - High

Example 4

INPUT
Hello Olelh
OUTPUT
YES
main.go