//0507-Square
#include <bits/stdc++.h>
using namespace std;
vector<int> num;
void dfs(int left,int prev){
	if(left==0){
		for(int i=0;i<(int)num.size();i++){
			if(i)	cout<<" ";
			cout<<num[i];
		}
		cout<<endl;
		return;
	}
	for(int i=min(prev,left);i>0;i--){
		num.push_back(i);
		dfs(left-i,i);
		num.erase(num.end()-1);
	}
	return;
}

int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)	return 0;
		dfs(n,n);
	}
	return 0;
}