i=input for i in sorted([i()+"A",i()+"B",i()+"C"],reverse=1):print(i[-1])