L = [] for i in 'ABC': H, W = map(int, input().split()) L += [[-H, W, i]] L = sorted(L) for H, W, i in L: print(i)