list2=["A","B","C"] list1=[] for i in range(3): line=input() line=line.rstrip().split(" ") list1.append([int(line[0]),100-int(line[1]),list2[i]]) list1.sort(reverse=True) #print(list1) for j in range(3): print(list1[j][2])