for x in sorted(input().split(), key=lambda x: x[1].upper()): print(x, end=' ')