h1, w1 = map(int, input().split()) h2, w2 = map(int, input().split()) h3, w3 = map(int, input().split()) rec = [] rec.append(("A", h1, w1)) rec.append(("B", h2, w2)) rec.append(("C", h3, w3)) rec = sorted(rec, key=lambda s: s[2]) rec = sorted(rec, key=lambda s: s[1], reverse=True) for i in rec: print(i[0])