##法一 nn = input() listt = input() mode = input() str_list = listt.split(" ") n_list = [int(i) for i in str_list] if mode == "0": n_list.sort() elif mode == "1": n_list.sort(reverse=True) else: print("error") out_str = "" for i in n_list:

out_str += str(i)
out_str += " "

print(out_str.strip())