var len=parseInt(readline()) var arr=readline().split(' ') var flag=readline() if(flag==='0'){ arr.sort((a,b)=>{return a-b}) } if(flag==='1'){ arr.sort((a,b)=>{return b-a}) } console.log(arr.join(' '))
var len=parseInt(readline()) var arr=readline().split(' ') var flag=readline() if(flag==='0'){ arr.sort((a,b)=>{return a-b}) } if(flag==='1'){ arr.sort((a,b)=>{return b-a}) } console.log(arr.join(' '))