#include <iostream>
#include <vector>
using namespace std;
vector<int> ilist;
int diophantine(int n, int i)
{
int nret=ilist.empty() ? 0 : ilist.back() -1;
if (n==0)
{
size_t x;
for (x=0; x < ilist.size(); x++) cout << " " << ilist[x];
cout << endl;
ilist.pop_back();
}
else if (i>0)
{
ilist.push_back(i);
diophantine(n, diophantine(n-i, n-i));
if (nret > 0) ilist.pop_back();
}
return (nret);
}
int main()
{
int n;
cin >> n;
if (n > 0)
{
diophantine(n, n);
}
else cout << "usage: prog <Z+>" << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZlY3RvcjxpbnQ+IGlsaXN0OwoKCmludCBkaW9waGFudGluZShpbnQgbiwgaW50IGkpCnsKICAgIGludCBucmV0PWlsaXN0LmVtcHR5KCkgPyAwIDogaWxpc3QuYmFjaygpIC0xOwogICAgCiAgICBpZiAobj09MCkgCiAgICB7CiAgICAgICAgc2l6ZV90IHg7CiAgICAgICAgZm9yICh4PTA7IHggPCBpbGlzdC5zaXplKCk7IHgrKykgY291dCA8PCAiICIgPDwgaWxpc3RbeF07CiAgICAgICAgY291dCA8PCBlbmRsOwogICAgICAgIGlsaXN0LnBvcF9iYWNrKCk7ICAgIAogICAgfQogICAgZWxzZSBpZiAoaT4wKQogICAgewogICAgICAgIGlsaXN0LnB1c2hfYmFjayhpKTsKICAgICAgICBkaW9waGFudGluZShuLCBkaW9waGFudGluZShuLWksIG4taSkpOwogICAgICAgIGlmIChucmV0ID4gMCkgaWxpc3QucG9wX2JhY2soKTsgICAgCiAgICB9ICAgICAgICAKICAgIAogICByZXR1cm4gKG5yZXQpOwp9CgoKaW50IG1haW4oKQp7CiAgICBpbnQgbjsgICAgCiAgICBjaW4gPj4gbjsgCiAKICAgIGlmIChuID4gMCkKICAgIHsKICAgICAgICBkaW9waGFudGluZShuLCBuKTsKICAgIH0KICAgIGVsc2UgY291dCA8PCAidXNhZ2U6IHByb2cgPForPiIgPDwgZW5kbDsKCiAgICByZXR1cm4gMDsKfQ==