#include <iostream>
using namespace std;
int n,
sum,
stack[ 101 ],
level;
void solve(int level) {
if(sum == n) {
for(int i = 1; i < level; ++i) {
cout<<stack[i]<<" ";
}
cout<<endl;
} else {
if(level==1) stack[level] = 0;
else stack[level] = stack[level-1] - 1;
while(stack[level] + sum < n) {
stack[level]+=1;
sum += stack[level];
solve(level+1);
sum -= stack[level];
}
}
}
void init() {
if(level==1)
stack[level] = 0;
else stack[level] = stack[level-1] - 1;
}
int succ() {
if(stack[level] + sum < n) {
stack[level]++;
return 1;
} else {
sum -= stack[level-1];
return 0;
}
}
int valid() {
if( stack[level] + sum <= n ) {
sum += stack[ level ];
return 1;
}
return 0;
}
int sol() {
return sum == n;
}
void print() {
for(int i = 1; i <= level; ++i) {
cout<<stack[i]<<" ";
}
cout<<endl;
sum -= stack[level];
}
void bk() {
level = 1;
init();
while( level > 0 ) {
int h,v;
h = 1;
v = 0;
while(h && !v) {
h = succ();
if(h) {
v = valid();
}
}
if(h) {
if(sol()) {
print();
} else {
level++;
init();
}
} else {
level--;
}
}
}
int main(int argc, char const *argv[]) {
sum = 0;
cin>>n;
solve(1);
// bk();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBuLAogICAgc3VtLAogICAgc3RhY2tbIDEwMSBdLAogICAgbGV2ZWw7Cgp2b2lkIHNvbHZlKGludCBsZXZlbCkgewoKICAgICBpZihzdW0gPT0gbikgewoKICAgICAgIGZvcihpbnQgaSA9IDE7IGkgPCBsZXZlbDsgKytpKSB7CgogICAgICAgICBjb3V0PDxzdGFja1tpXTw8IiAiOwoKICAgICAgIH0KCiAgICAgICBjb3V0PDxlbmRsOwoKICAgICB9IGVsc2UgewoKICAgICAgICBpZihsZXZlbD09MSkgc3RhY2tbbGV2ZWxdID0gMDsKICAgICAgICAKICAgICAgICBlbHNlIHN0YWNrW2xldmVsXSA9IHN0YWNrW2xldmVsLTFdIC0gMTsKCiAgICAgICAgd2hpbGUoc3RhY2tbbGV2ZWxdICsgc3VtIDwgbikgewoKICAgICAgICAgICAgICBzdGFja1tsZXZlbF0rPTE7CgogICAgICAgICAgICAgIHN1bSArPSBzdGFja1tsZXZlbF07CgogICAgICAgICAgICAgIHNvbHZlKGxldmVsKzEpOwoKICAgICAgICAgICAgICBzdW0gLT0gc3RhY2tbbGV2ZWxdOwogICAgICAgIH0KICAgICB9Cn0KCnZvaWQgaW5pdCgpIHsKICAgIGlmKGxldmVsPT0xKQogICAgIHN0YWNrW2xldmVsXSA9IDA7CiAgICBlbHNlIHN0YWNrW2xldmVsXSA9IHN0YWNrW2xldmVsLTFdIC0gMTsKfQoKaW50IHN1Y2MoKSB7CgogICAgaWYoc3RhY2tbbGV2ZWxdICsgc3VtIDwgbikgewogICAgICAgc3RhY2tbbGV2ZWxdKys7CiAgICAgICByZXR1cm4gMTsKICAgIH0gIGVsc2UgewogICAgICAgc3VtIC09IHN0YWNrW2xldmVsLTFdOwogICAgICAgcmV0dXJuIDA7CiAgICB9Cn0KCmludCB2YWxpZCgpIHsKCiAgICBpZiggc3RhY2tbbGV2ZWxdICsgc3VtIDw9IG4gKSB7CgogICAgICAgIHN1bSArPSBzdGFja1sgbGV2ZWwgXTsKCiAgICAgICByZXR1cm4gMTsKICAgIH0KCiAgICByZXR1cm4gMDsKfQoKaW50IHNvbCgpIHsKCiAgcmV0dXJuIHN1bSA9PSBuOwp9Cgp2b2lkIHByaW50KCkgewoKICAgIGZvcihpbnQgaSA9IDE7IGkgPD0gbGV2ZWw7ICsraSkgewoKICAgICAgY291dDw8c3RhY2tbaV08PCIgIjsKICAgIH0KCiAgICBjb3V0PDxlbmRsOwoKICAgIHN1bSAtPSBzdGFja1tsZXZlbF07Cn0KCnZvaWQgYmsoKSB7CgogIGxldmVsID0gMTsKCiAgaW5pdCgpOwoKICB3aGlsZSggbGV2ZWwgPiAwICkgewoKICAgICAgaW50IGgsdjsKCiAgICAgIGggPSAxOwogICAgICB2ID0gMDsKICAgICAgd2hpbGUoaCAmJiAhdikgewogICAgICAgIGggPSBzdWNjKCk7CiAgICAgICAgaWYoaCkgewogICAgICAgICAgdiA9IHZhbGlkKCk7CiAgICAgICAgfQogICAgICB9CgogICAgICBpZihoKSB7CiAgICAgICAgaWYoc29sKCkpIHsKICAgICAgICAgIHByaW50KCk7CiAgICAgICAgfSBlbHNlIHsKICAgICAgICAgIGxldmVsKys7CiAgICAgICAgICBpbml0KCk7CiAgICAgICAgfQogICAgICB9IGVsc2UgewogICAgICAgIGxldmVsLS07CiAgICAgIH0KICB9Cn0KCmludCBtYWluKGludCBhcmdjLCBjaGFyIGNvbnN0ICphcmd2W10pIHsKCiAgc3VtID0gMDsKICAKICBjaW4+Pm47CiAgCiAgc29sdmUoMSk7CiAgCiAvLyBiaygpOwogCiAgcmV0dXJuIDA7Cgp9Cg==