import List main=interact$unlines.f[].sortBy(\a b->compare(n b::Int)$n a).lines n=read.last.words f _[]=[] f x(h:t)=(show(1+sum[1|y<-x,y>n h])++' ':h):f(n h:x)t