a=readLines("stdin") write(a[sort(c(scan(textConnection(a[1]))+1,2:length(a)))],"")