def main(): y = [] for z in 'ABC': y.append((input(), z)) for k, v in sorted(y, reverse=True): print(v) if __name__ == '__main__': main()