# Read input ha, wa = map(int, input().split()) hb, wb = map(int, input().split()) hc, wc = map(int, input().split()) # Create list of people with their attributes people = [ (ha, wa, 'A'), (hb, wb, 'B'), (hc, wc, 'C'), ] # Sort by descending height, then ascending weight sorted_people = sorted(people, key=lambda x: (-x[0], x[1])) # Output the names in order for p in sorted_people: print(p[2])