You are given a list of student information: ID, FirstName, and CGPA. Your task is to rearrange them according to their CGPA in decreasing order. If two student have the same CGPA, then arrange them according to their first name in alphabetical order. If those two students also have the same first name, then order them according to their ID. No two students have the same ID.
Hint: You can use comparators to sort a list of objects. See the oracle docs to learn about comparators.
The first line of input contains an integer , representing the total number of students. The next lines contains a list of student information in the following structure:
ID Name CGPA
The name contains only lowercase English letters. The contains only integer numbers without leading zeros. The CGPA will contain, at most, 2 digits after the decimal point.
After rearranging the students according to the above rules, print the first name of each student on a separate line.