#include <stdio.h>
int ans[32],last;int mn(int a, int b) {return (a<b)?a:b;}void pintf() {for (int i=0;i<last;printf("%d ",ans[i++]));printf("%d\n",ans[last]);}
void dfs(int val,int q) {val-=q;if (!val) {--last,pintf();return;}for (int i=mn(val,q);i>=1;i--) ans[last++]=i,dfs(val,i);last--;}
int main() {int N;while (1) {scanf("%d",&N);if (!N) return 0;last=0;dfs(N<<1,N);}}