d = {} d['A'] = input() d['B'] = input() d['C'] = input() for key, value in sorted(d.items(), key=lambda x:x[1]): print(key)