import java.util.Comparator; import java.util.Scanner; import java.util.stream.Stream; public class Main{ static Scanner s=new Scanner(System.in); static int getInt(){return Integer.parseInt(s.next());} public static void main(String[] $){ int[]h=new int[3]; int[]w=new int[3]; h[0]=getInt(); w[0]=getInt(); h[1]=getInt(); w[1]=getInt(); h[2]=getInt(); w[2]=getInt(); Stream.of('A','B','C') .sorted(Comparator.comparingInt(o->-h[o-'A']).thenComparingInt(o->w[o-'A'])) .forEach(System.out::println); } }