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