l = [] for i in range(3): h,w = map(int,input().split()) l.append((h,-w,chr(ord('A') + i))) l.sort() for h,w,s in reversed(l): print(s)