A = list(map(int,input().split())) B = list(map(int,input().split())) C = list(map(int,input().split())) dct = {"A":[A[0],A[1]], "B":[B[0],B[1]], "C":[C[0],C[1]]} for k, v in sorted(dct.items(), key=lambda x,y: -x[1][0]-y[1][1]): print(k)