import qualified Control.Monad as M 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 putStr . unlines . map (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]