import qualified Control.Monad as M import qualified Data.ByteString.Char8 as B main :: IO () main = do n <- readLn :: IO Int let m = (n `div` 2) + 1 M.forM_ [1..n] $ \i -> do B.putStrLn $ B.pack $ unwords . map show $ shift (i - 1) $ merge [1..m] [m+1..n] merge :: [Int] -> [Int] -> [Int] merge xs [] = xs merge [] ys = ys merge (x:xs) (y:ys) = x : y : merge xs ys shift :: Int -> [Int] -> [Int] shift n xs = drop n xs ++ take n xs