package yukicoder174; 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(); if(h1 > h2) { if(h2 > h3) { System.out.println("A"); System.out.println("B"); System.out.println("C"); } else if(h2 == h3) { if(w2 > w3) { System.out.println("A"); System.out.println("C"); System.out.println("B"); } else { System.out.println("A"); System.out.println("B"); System.out.println("C"); } } } else if(h1 > h3) { if(h3 > h2) { System.out.println("A"); System.out.println("C"); System.out.println("B"); } else if(h3 == h2) { if(w3 > w2) { System.out.println("A"); System.out.println("B"); System.out.println("C"); } else { System.out.println("A"); System.out.println("C"); System.out.println("B"); } } } else if(h2 > h1) { if(h1 > h3) { System.out.println("B"); System.out.println("A"); System.out.println("C"); } else if(h1 == h3) { if(w1 > w3) { System.out.println("B"); System.out.println("C"); System.out.println("A"); } else { System.out.println("B"); System.out.println("A"); System.out.println("C"); } } } else if(h2 > h3) { if(h3 > h1) { System.out.println("B"); System.out.println("C"); System.out.println("A"); } else if(h3 == h1) { if(w3 > w1) { System.out.println("B"); System.out.println("A"); System.out.println("C"); } else { System.out.println("A"); System.out.println("C"); System.out.println("B"); } } } else if(h3 > h1) { if(h1 > h2) { System.out.println("C"); System.out.println("A"); System.out.println("B"); } else if(h1 == h2) { if(w1 > w2) { System.out.println("C"); System.out.println("B"); System.out.println("A"); } else { System.out.println("C"); System.out.println("A"); System.out.println("B"); } } } else if(h3 > h2) { if(h2 > h1) { System.out.println("C"); System.out.println("B"); System.out.println("A"); } else if(h2 == h1) { if(w2 > w1) { System.out.println("C"); System.out.println("A"); System.out.println("B"); } else { System.out.println("C"); System.out.println("B"); System.out.println("A"); } } } } }