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