import java.util.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int[] height = new int[3]; int[] weight = new int[3]; String[] name = {"A","B","C"}; Map map = new TreeMap<>(Comparator.reverseOrder()); for (int i=0; i<3; i++) { height[i] = sc.nextInt()*1000; weight[i] = -(sc.nextInt()); map.put(height[i]+weight[i],name[i]); } for (Map.Entry entry : map.entrySet()) { System.out.println(entry.getValue()); } } }