import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Scanner; public class Main { static public void main(String[]args) throws Exception { Scanner sc = new Scanner(System.in); final int NUM = 3; List list = new ArrayList<>(); for(int i=0; i < NUM; i++) { int h = sc.nextInt(); int w = sc.nextInt(); char c = (char) ('A' + i); String name = String.valueOf(c); list.add(new Person(name, h, w)); } Collections.sort(list, new PersonComparator()); for(int i=0; i < NUM; i++) { System.out.println(list.get(i).getName()); } } } class Person { private String name; private int heigth; private int weight; private Person() { } public Person(String name, int heigth, int weight) { this.name = name; this.heigth = heigth; this.weight = weight; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getHeigth() { return heigth; } public void setHeigth(int heigth) { this.heigth = heigth; } public int getWeight() { return weight; } public void setWeight(int weight) { this.weight = weight; } } class PersonComparator implements Comparator { @Override public int compare(Person p1, Person p2) { int dh = p1.getHeigth() - p2.getHeigth(); if(dh != 0) { return -dh; } else { int dw = p1.getWeight() - p2.getWeight(); return dw; } } }