d={} d['A']=int(input()) d['B']=int(input()) d['C']=int(input()) for i in sorted(d,key=lambda x:d[x])[::-1]: print(i)