import Data.List

manyMedians :: Int -> [Int] -> [Int]
manyMedians n xs = [ if (a `elem` front) then b1 else b2 | a <- xs]
    where
        (front,back) = genericSplitAt (n `div` 2) . sort $ xs
        b1 = head back
        b2 = last front
        
main :: IO ()
main = do
    n <- read <$> getLine
    xs <- map read . words <$> getLine
    putStrLn . unwords . map show $ manyMedians n xs