def main(): ha, wa = map(int, input().split()) hb, wb = map(int, input().split()) hc, wc = map(int, input().split()) if ha == hb: if wa > wb: a_is_better_than_b = False else: a_is_better_than_b = True elif ha > hb: a_is_better_than_b = True else: a_is_better_than_b = False if ha == hc: if wa > wc: a_is_better_than_c = False else: a_is_better_than_c = True elif ha > hc: a_is_better_than_c = True else: a_is_better_than_c = False if hb == hc: if wb > wc: b_is_better_than_c = False else: b_is_better_than_c = True elif hb > hc: b_is_better_than_c = True else: b_is_better_than_c = False if a_is_better_than_b: if b_is_better_than_c: print("A") print("B") print("C") else: if a_is_better_than_c: print("A") print("C") print("B") else: print("C") print("A") print("B") else: if a_is_better_than_c: print("B") print("A") print("C") else: if b_is_better_than_c: print("B") print("C") print("A") else: print("C") print("B") print("A") if __name__ == '__main__': main()