#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;
}