#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int N;
vector<vector<int>> V;

void recursive(vector<int> vec,int pre,int tmp_sum){

	for(int i = min(pre,N-tmp_sum); i >= 1; i--){

		vector<int> next = vec;
		next.push_back(i);

		int next_tmp_sum = tmp_sum+i;

		if(next_tmp_sum == N){
			V.emplace_back(next); //★注意★
			continue;
		}
		recursive(next,i,next_tmp_sum);
	}
}

void func(){

	V.clear();

	vector<int> first;

	recursive(first,BIG_NUM,0);

	for(int i = 0; i < V.size(); i++){
		printf("%d",V[i][0]);
		for(int k = 1; k < V[i].size(); k++){
			printf(" %d",V[i][k]);
		}
		printf("\n");
	}
}

int main(){

	while(true){

		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

