print(*tuple(zip(*sorted((int(input()), h) for h in "ABC")[::-1]))[1], sep="\n")