#include<stdio.h>
#include<vector>
std::vector<int>v;
void f(int n,int d)
{
	int i;
	if(n==0)
	{
		for(i=0;i<v.size();++i)printf("%s%d",i?" ":"",v[i]);
		puts("");
	}
	else
		for(i=(d<n?d:n);i>0;--i)
		{
			v.push_back(i);
			f(n-i,i);
			v.pop_back();
		}
}
int main()
{
	int n;
	while(scanf("%d",&n),n) f(n,n);
	return 0;
}