#include <iostream>
#include <queue>
using namespace std;

typedef deque <int> DI;

DI boxes;

void solve( int n, int m )
{
	if ( n == 0 )
	{
		for ( DI::iterator it = boxes.begin(); it != boxes.end(); it++ )
		{
			cout << *it;
			if ( it+1 != boxes.end() ) cout << " ";
			else cout << endl;
		}
		return;
	}

	for ( int i = m; i > 0; i-- )
	{
		if ( n-i >= 0 )
		{
			boxes.push_back( i );
			solve( n-i, i );
			boxes.pop_back();
		}
	}
}

int main( void )
{
	int n;
	while ( cin >> n && n )
	{
		boxes.clear();
		solve( n, n );
	}
}