import Data.List

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