eval'N,*A='+$<.read.split*?, (1..2*N-2).map{|i|(0..i/2).map{|a|b=i-a;b>N-2&&next;A[a]>(c=A[b])&&(A[b]=A[a];A[a]=c)}} $><