def f(header, n, max)
    puts header + n.to_s if n <= max
    [max, n-1].min.downto(1){|i|
        f(header + "#{i} ", n - i, i)
    }
end

loop {
    n = gets.to_i
    break if n == 0
    f("", n, n)
}