import Data.List

main :: IO ()
main = do
  n <- readLn
  xs <- map read . words <$> getLine
  let ms = med xs
  mapM_ (print . solve ms) xs

med :: [Int] -> [Int]
med = take 2 . drop (n `div` 2 - 1) . sort

solve :: [Int] -> Int -> Int
solve [ml, mr] x
  | x <= ml = mr
  | x >= mr = ml
  | otherwise = undefined 

