import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = getLine >> readLine >>= printRes . solve
    where
        printRes = putStrLn . unwords . map show

-- |
-- >>> solve [6, 9, 4, 2, 11]
-- [11,6]
-- >>> solve [100, 0]
-- [100,0]
solve :: [Int] -> [Int]
solve = check . sortBy (flip compare)
    where
        check (x : xs) = [x, head $ sortBy cmpf xs]
            where
                hx = x `div` 2
                cmpf = comparing (abs . (hx -))


readLine :: IO [Int]
readLine = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine