#include<iostream>
#include<vector>
using namespace std;

vector< vector<int> > vv;
void dfs(int n,int max, vector<int> v) {
  for(int i=1; i<=max; ++i) {
    if(n==i) {
      v.push_back(i);
      vv.push_back(v);
      break;
    }
    vector<int> nv = v;
    nv.push_back(i);
    dfs(n-i, i, nv);
  }
  return;
}

int main() {
  int n;
  while(cin>>n, n) {
    vv.clear();
    dfs(n,n, vector<int>());
    for(vector< vector<int> >::reverse_iterator i=vv.rbegin(); i != vv.rend(); ++i) {
      for(int j=0; j<(*i).size(); ++j) {
	cout<<(*i).at(j);
	if(j<(*i).size()-1)
	  cout<<" ";
      }
      cout<<endl;
    }
  }
}