{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} import Control.Applicative import Control.Monad import qualified Data.ByteString.Char8 as B import Data.Maybe (fromJust) import Data.List import Text.Printf import Debug.Trace construct :: Int -> Int -> [Int] construct 1 b = [b] construct k b = [b] ++ construct k2 (b-k2) ++ construct k2 (b+k2) where k2 = k `div` 2 swapl (x:y:zs) = y:x:zs main = do [k] <- getInts let ans = swapl $ construct (2^(k-1)) (2^(k-1)) putStrLn $ intercalate " " (map show ans) -- util getInts :: IO [Int] getInts = map (fst . fromJust . B.readInt) . B.words <$> B.getLine substr :: Int -> Int -> B.ByteString -> B.ByteString substr b l s = B.take l $ B.drop b s