INF = 2 << 32
def out stat, remain
  puts stat.join(' ') if remain.zero?
  ([stat.last || INF, remain].min.downto(1)).each {|n|
    out(stat << n, remain - n)
  }
  stat.pop
end

until (n = gets.to_i) == 0
  out [], n
end