Square (AOJ 0507) by letter
Contest: 3575    RunID: 2376127    Status: WA: Presentation Error    Date: Sat Jun 17 15:39:49 JST 2017


#include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;

#define DEBUG false

void dfs(vector<int> v, int n, int u){
	
	if(n == 0) {
		rep(i, v.size()){
			cout << v[i];
			if(i != v.size()-1) cout << "\t";
		}
		cout << endl;
		return;
	}
	for(int i = min(n, u); i > 0; i--){
		vector<int> tmp(v);
		tmp.push_back(i);
		dfs(tmp, n-i, i);
	}
	
	return;
}

int main(){

	int n;
	while(cin >> n, n){
		
		vector<int> null;
		dfs(null, n, n);
		
	}
	
	
	
	return 0;
}