{-# LANGUAGE OverloadedStrings #-} 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 let xs = merge [1..m] [m+1..n] let ys = iterate shift xs B.putStr . B.unlines . map (B.pack . unwords . map show) . take n $ ys merge :: [Int] -> [Int] -> [Int] merge xs [] = xs merge [] ys = ys merge (x:xs) (y:ys) = x : y : merge xs ys shift :: [Int] -> [Int] shift xs = tail xs ++ [head xs]