// 再帰でリスト作ればいけるね
#include <stdio.h>
#include <stdlib.h>
struct list { int n; struct list* next; };
void print_list( struct list* p )
{
  for( ; p != 0 ; p = p->next ) printf( " %d" , p->n );
  puts( "" );
}
void xxx( int n , struct list* p )
{
  if( n > 0 )
  {
    struct list node;
    node.next = p;
    for( node.n = 1 ; node.n <= n ; ++node.n ) xxx( n - node.n , &node );
  }
  else
  {
    print_list( p );
  }
}
int main( int argc , char* argv[] )
{
  if( argc > 1 ) xxx( atoi( argv[1] ) , 0 );
  return 0;
}