• + 0 comments

    import java.io.; import java.util.; import java.util.stream.Collectors;

    class Details{ int id; String name; double point;

    public Details(int id,String name,double point){
        this.id = id;
        this.name = name;
        this.point = point;
    }
    
    public String getName(){
        return name;
    }
    public int getId(){
        return id;
    }
    public double getPoint(){
        return point;
    }
    

    }

    public class Main {

    public static void main(String[] args) {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        Scanner persons = new Scanner(System.in);
        int numberOfPersons = persons.nextInt();
    
       List<Details> students = new ArrayList<>();
    
    
    
        for(int i=0;i<numberOfPersons;i++){
            int id = persons.nextInt();
            String name = persons.next();
            double point = persons.nextDouble();
             students.add(new Details(id, name, point));
    
        }
        persons.close();
    
       List<Details> answer = students.stream().sorted(Comparator.comparingDouble(Details::getPoint).reversed().thenComparing(Details::getName).thenComparingInt(Details::getId)).collect(Collectors.toList());
    
      answer.forEach(student->System.out.println(student.name));
    
    
    }
    

    }