import Data.List
main=do
 n<-readLn;a<-map read.words<$>getLine
 (putStr.concat)(g n a (f n (sort a)))
  where f n a = [a!!((quot n 2)-1),a!!(quot n 2)]::[Int]
        g 0 _ _ = []
        g n (h:a) [l,r] =(if h<r then[(show r)++"\n"]else[(show l)++"\n"])++(g(n-1)a[l,r])