a=[list(map(int,input().split()))+[chr(65+i)] for i in range(3)] a=sorted(a,key=lambda x :(-x[0],x[1])) for i in range(3): print(a[i][2])