hw_list = [] h, w = map(int, (input().split())) hw_list.append(['A', h, w]) h, w = map(int, (input().split())) hw_list.append(['B', h, w]) h, w = map(int, (input().split())) hw_list.append(['C', h, w]) hw_list = sorted(hw_list, key=lambda x:(-x[1],x[2])) for hw in hw_list: print(hw[0])