package yukicoder174; import java.util.Arrays; import java.util.Comparator; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int h1 = sc.nextInt(),w1 = sc.nextInt(); int h2 = sc.nextInt(),w2 = sc.nextInt(); int h3 = sc.nextInt(),w3 = sc.nextInt(); Pair[] p = {new Pair(h1, w1, 'A'), new Pair(h2, w2, 'B'), new Pair(h3, w3, 'C')}; Arrays.sort(p, new Comparator() { public int compare(Pair p1, Pair p2) { if(p2.h == p1.h) { return p1.w - p2.w; } return p2.h - p1.h; } }); for(int i = 0 ; i < 3 ; i++) { System.out.println(p[i].c); } } public static class Pair { int h; int w; char c; Pair(int h, int w, char c) { this.h = h; this.w = w; this.c = c; } } }