ans = [] for i in range(3): H, W = map(int, input().split()) ans.append((-H, W, chr(ord("A") + i))) ans.sort() for _, _, a in ans: print(a)