a=[] for i in range(3): h,w=map(int,input().split()) a.append((-h,w,chr(ord('A')+i))) for i in sorted(a): print(i[2])