import Data.Array
import Data.List
import Control.Monad

getAB::[Int]->Int->(Int,Int)
getAB ls n = let a:b:_= drop ((div n 2)-1) (sort ls) in (a,b)

solver::Array Int Int -> (Int,Int) -> Int -> Int
solver ar (a,b) i = if (ar!i)<=a then b else a

main::IO()
main=do
  nc<-getLine
  let n = read nc ::Int
  d<-getLine
  let dat = map read (words d)
  let (a,b) = getAB dat n
  let ar = listArray (1,n) dat
  forM_ [1..n] (\i -> print (solver ar (a,b) i))