HW = [] for _ in range(3): h, w = map(int, input().split()) HW.append((h, w)) sorted_HW = sorted(HW, key=lambda x: (-x[0], x[1])) # print('HW', HW) for h, w in sorted_HW: for i, hw in enumerate(HW): _h, _w = hw if h == _h and w == _w: print('ABC' [i])