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