import Control.Applicative
import Data.List (sort)

main = do
  n <- read <$> getLine :: IO Int
  ps <- map read.words <$> getLine :: IO [Int]
  let as = map snd $ sort $ zip ps [1,3..]
      bs = map snd $ sort $ zip ps [2*n,2*n-1..]
  putStrLn $ unwords $ map show as
  putStrLn $ unwords $ map show bs
