import Control.Applicative
import Control.Monad
import Data.List
import qualified Data.Vector as V

main :: IO()
main = do
    n <- read <$> getLine
    xs <- map read . words <$> getLine
    forM_ (solve xs n) print

solve :: [Int] -> Int -> [Int]
solve xs n = map sub [0..(length xs - 1)]
    where
        v = V.fromList xs
        lm = largeMedian xs n
        sm = smallMedian xs n
        sub idx = if (v V.! idx) <= sm
            then lm
            else sm

largeMedian :: [Int] -> Int -> Int
largeMedian [] _ = error "error"
largeMedian xs n = (tail $ sort xs) !! (n `div` 2 - 1)

smallMedian :: [Int] -> Int -> Int
smallMedian [] _ = error "error"
smallMedian xs n = (init $ sort xs) !! (n `div` 2 - 1)
