d=dict(zip([x+(100-y)/1000 for x,y in [map(int,input().split()) for i in'.'*3]],['A','B','C'])) for i in sorted(d.items(),reverse=True): print(i[1])