#include<iostream>
#include<vector>

int n;
std::vector<int> vec;
void func(int a, int b)
{		
	for (int i = a; i != 0; --i)
	{
		if (b >= i)
		{
			vec.push_back(i);
			if (i == a)
			{
				for (int j = 0; j != vec.size(); ++j)
				{
					std::cout << vec[j];
					if (j != vec.size() - 1)
						std::cout << " ";
				}
				std::cout << std::endl;
			}
			else
				func(a - i, i);
			vec.pop_back();
		}
	}
}

int main()
{
	while (std::cin >> n)
	{
		if (n == 0)
			break;
		func(n, n);
	}

	return 0;
}