#include<iostream>
#include<vector>

void rec(int n, int min_n, std::vector<int> v){
	if(n == 0){
		std::cout << v[0];
		for(int i=1;i<v.size();i++){
			std::cout << " " << v[i];
		}
		std::cout <<  std::endl;
	}

	int max_n = std::min(n, min_n);
	for(int i=max_n;i;i--){
		v.push_back(i);
		rec(n-i, i, v);
		v.erase(v.end() - 1);
	}
}

int main(){
	int n;
	while(std::cin >> n, n){
		for(int i=n;i;i--){
			rec(n-i, i, {i});
		}
	}
}