# Here your code !
while (n = gets.to_i) != 0
a = Array.new(n)
a[0] = n
puts n

while a.last.nil? do
    i = a.index {|k| k.nil? || k == 1}
    a[i-1] -= 1
    j = a.index {|k| k.nil? || k < a[i-1]}
    a[j] = a[j].nil? ? 1 : a[j]+1
    puts (a.select {|k| !k.nil?}).join(" ")
end
end