ah,aw = map(int, input().split(' ')) bh,bw = map(int, input().split(' ')) ch,cw = map(int, input().split(' ')) d = {} d['A'] = ah * 1000 + 1000 - aw d['B'] = bh * 1000 + 1000 - bw d['C'] = ch * 1000 + 1000 - cw while(len(d.keys()) > 0): print(max(d, key=d.get)) d.pop(max(d, key=d.get))