import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Person[] persons = new Person[3]; for (int i = 0; i < 3; i++) { persons[i] = new Person((char)(i + 'A'), sc.nextInt(), sc.nextInt()); } Arrays.sort(persons); for (int i = 0; i < 3; i++) { System.out.println(persons[i].id); } } static class Person implements Comparable { char id; int height; int weight; public Person (char id, int height, int weight) { this.id = id; this.height = height; this.weight = weight; } public int compareTo(Person another) { if (height == another.height) { return weight - another.weight; } else { return another.height - height; } } } }