import java.util.*; import java.text.*; public class Main { static class ob { String code, name; Long price; public ob(String code, String name, long price){ this.code = code; this.name = name; this.price = price; } } static class ob2{ ob o; String code; Long total; public ob2(ob o, String code, long sl){ this.code = code; this.o = o; this.total = o.price*sl; } @Override public String toString(){ return code + " " + o.name + " " + total; } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); ArrayList a = new ArrayList<>(); ArrayList b= new ArrayList<>(); for(int i=0;i { if(x.total.compareTo(y.total) == 0) return x.o.name.compareTo(y.o.name); return y.total.compareTo(x.total); }); b.forEach(e -> System.out.println(e)); } }