def f_saiki(n)
  i = n
  while i > 0 do
    saiki(n, i, [])
    i -= 1
  end
end

def saiki(n, i, a)
  if n == i
    a << i
    puts a.join(" ")
  else
    j = n - i
    while j > 0 do
      if j > i
        j -= 1
        next
      end
      saiki(n - i, j, a + [i])
      j -= 1
    end
  end
end

while (n = gets.to_i) != 0 do
  f_saiki(n)
end