h1,w1 = map(int,input().split()) h2,w2 = map(int,input().split()) h3,w3 = map(int,input().split()) a = [["A",h1,w1],["B",h2,w2],["C",h3,w3]] b = sorted(a, key=lambda x:(x[1],-x[2]),reverse=True) for c in b: print(c[0])