#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n;
void solve(int n,int a,int sel[],int cnt){
  if(n < 0 || a <= 0) return;
  if(n == 0 && a == 1) {
    int flg = 0;
    for(int i=0;i<cnt;i++){
      if(flg) cout << " ";
      cout << sel[i];
      flg = 1;
    }
    cout << endl;
    return;
  }
  sel[cnt] = a;
  solve(n-a,a,sel,cnt+1);
  solve(n,a-1,sel,cnt);
  return;
}
int main(){
  while(cin >> n , n){
    int sel[100]={0};
    solve(n,n,sel,0);
  } 
}