module Main where

import Data.Functor
import Control.Monad

main :: IO ()
main=do
  n <- read <$> getLine::IO Int
  when (n/=0) (print (allPat n n) >> main)

allPat::Int->Int->[[Int]]
allPat n l
  |n==0 = [[]]
  |n<0 =[]
  |otherwise =(\m->(m:) <$> allPat (n-m) m) =<< [l,(l-1)..1]