import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); Person[] arr = new Person[3]; for (int i = 0; i < 3; i++) { arr[i] = new Person((char)(i + 'A'), sc.nextInt(), sc.nextInt()); } Arrays.sort(arr); StringBuilder sb = new StringBuilder(); for (Person p : arr) { sb.append(p.name).append("\n"); } System.out.print(sb); } static class Person implements Comparable { char name; int height; int weight; public Person(char name, int height, int weight) { this.name = name; this.height = height; this.weight = weight; } public int compareTo(Person another) { if (height == another.height) { return weight - another.weight; } else { return another.height - height; } } } }