L1 = 'ABC' L2 = [int(input()) for _ in range(3)] L = [[j, i] for i, j in zip(L1, L2)] for _, i in sorted(L)[::-1]: print(i)