n=gets.to_i a=gets.split.map &:to_i (1..2*n-4).map{|i|n.times{|p|p<(q=i-p)&&qa[q]&&(t=a[p];a[p]=a[q];a[q]=t)}} puts a.join ' '