### subroutines

def get_div(prev, n)
  prev = n if prev > n
  return $gdcache[prev][n] if ! $gdcache[prev][n].nil?

  n0 = [prev, n].min
  ret = []

  while n0 >= 1
    nn = n - n0
    if nn == 0
      ret << [n0]
    else
      ret0 = get_div(n0, nn)
      for r in ret0
        ret << ([n0] + r)
      end
    end

    n0 -= 1
  end

  $gdcache[prev][n] = ret
end

### main

loop do
  n = gets.strip.to_i
  break if n == 0

  $gdcache = (n + 1).times.map{[]}

  for i in (1..n)
    $gdcache[i][1] = [[1]]
  end

  ret = get_div(n, n)

  for ns in ret
    puts ns.join(' ')
  end
end