{-# LANGUAGE BangPatterns, MultiWayIf #-}
import Control.Arrow
import Control.Monad.Fix
import Data.Int
import Data.Foldable
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as B
import Data.ByteString.Internal (accursedUnutterablePerformIO)
import Debug.Trace

unew :: VUM.Unbox a => Int -> VUM.IOVector a
unew !n = accursedUnutterablePerformIO $ VUM.new n

uread :: VUM.Unbox a => Int -> VUM.IOVector a -> a
uread !i !v = accursedUnutterablePerformIO $ VUM.unsafeRead v i

uwrite :: VUM.Unbox a => Int -> a -> VUM.IOVector a -> VUM.IOVector a
uwrite !i !a !v =
  accursedUnutterablePerformIO $ VUM.unsafeWrite v i a >> return v

uthaw :: VUM.Unbox a => VU.Vector a -> VUM.IOVector a
uthaw !v = accursedUnutterablePerformIO $ VU.unsafeThaw v

ufreeze :: VUM.Unbox a => VUM.IOVector a -> VU.Vector a
ufreeze !v = accursedUnutterablePerformIO $ VU.unsafeFreeze v

uset :: VUM.Unbox a => a -> VUM.IOVector a -> VUM.IOVector a
uset !a !v = accursedUnutterablePerformIO $ VUM.set v a >> return v

solve :: Int -> VU.Vector Int -> (VU.Vector Int, VU.Vector Int)
solve !n !pn = (an, bn)
 where
  an = VU.map (\(!i) -> 2 * i + 1) $ VU.fromList [0 .. n - 1]
  bn =
    (\(!bn) ->
        let mbn = VU.minimum bn
        in  if mbn <= 0 then VU.map (+ (-mbn + 1)) bn else bn
      )
      $ ufreeze
      $ VU.ifoldl'
          (\(!acc) (!i) (!pi) -> uwrite (pi - 1) (i * 10000 - 2 * pi - 1) acc)
          (unew n)
          pn

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  pn <- VU.unfoldrN n readInt <$> B.getLine
  let (an, bn) = solve n pn
  VU.forM_ an $ \i -> do
    putStr $ show i
    putStr " "
  putStrLn ""

  VU.forM_ bn $ \i -> do
    putStr $ show i
    putStr " "
  putStrLn ""
