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

vector<int> v;

void dfs(int r)
{
  if(r==0){
    for(int i=0; i<v.size()-1; i++){
      cout << v[i] << " ";
    }
    cout << v.back() << endl;
    return;
  }

  for(int i=r; i>0; i--){
    if(!v.empty()) if(v.back()<i) continue;
    v.push_back(i);
    dfs(r-i);
    v.pop_back();
  }
}

int main()
{
  int n;
  while(cin >> n, n){
    dfs(n);
  }
}