Lst = [] for a in 'ABC': H,W = map(int, input().split()) Lst += [[-H, W, a]] Lst.sort() for H,W,a in Lst: print(a)