b=[] for i in range(3): h,w = map(int,input().split()) b.append([-h,w,i]) b.sort() [print("ABC"[i[2]])for i in b]