a = input().split() a.sort(key=lambda x: x[1]) print(' '.join(a)