import sys

data=sys.stdin.readlines()
l=data[1].split(" ")

for i in range(len(l)):
    l[i]=int(l[i])


if int(data[2])==0:
    l=sorted(l)

if int(data[2])==1:
    l=sorted(l)
    l.reverse()

result=""
for item in l:
    result=result+str(item)+" "
print(result)