#K82832. Employee Sorting Challenge
Employee Sorting Challenge
Employee Sorting Challenge
You are given a list of employees, each with a unique ID, a name, and an age. Your task is to sort the employees in ascending order primarily by their age and, if two employees have the same age, sort them by their ID in ascending order.
The input is given via standard input where the first line contains an integer \( n \) denoting the number of employees. The following \( n \) lines each contain the details of one employee in the format:
[ ID \quad Name \quad Age ]
The output should list the sorted employees on separate lines in the same format. Make sure your solution reads input from standard input (stdin) and writes output to standard output (stdout).
inputFormat
The input is given from standard input as follows:
- The first line contains an integer \( n \), representing the number of employees.
- The next \( n \) lines each contain three values: an integer ID, a string Name, and an integer Age, separated by spaces.
outputFormat
The output should be printed to standard output where each line contains the sorted employee details in the format:
\[ ID \quad Name \quad Age \]Employees are listed one per line, with the sorting order being primarily by age in ascending order and then by ID in ascending order if ages are identical.
## sample5
1234 Alice 30
5678 Bob 22
9101 Eve 30
8765 Charlie 22
4321 Dave 25
5678 Bob 22
8765 Charlie 22
4321 Dave 25
1234 Alice 30
9101 Eve 30
</p>