s = input() s = s.split() for i in range(len(s)): s[i] = eval(s[i]) print(sorted(s)) print(sorted(s,reverse=True))