import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import java.util.Scanner; public class No571 { public static void main(String[] args) { Scanner s = new Scanner(System.in); LinkedHashMap map = new LinkedHashMap<>(); map.put("A", new Integer[]{s.nextInt(), s.nextInt()}); map.put("B", new Integer[]{s.nextInt(), s.nextInt()}); map.put("C", new Integer[]{s.nextInt(), s.nextInt()}); map.entrySet().stream() .sorted(Map.Entry.comparingByValue((o1, o2) -> { if (o1[0] < o2[0] || Objects.equals(o1[0], o2[0]) && o1[1] > o2[1]) { return 1; } return -1; })) .forEach(e -> System.out.println(e.getKey())); } }