#include "stdio.h"
int data[]={4816,4776,4498,4616,4948,4684,4710,5266,4760,5168,4770,5134,5076,4784,
5174,4732,4782,4746,4730,5224,5164,4742,4724,4730,4762,4162,4188,4830,4942,4072,
4270,4520,4808,5130,4272,4262,4238,4240,4828,4168,4754,4720,4896,4824,5206,4322,
3800,4826,4632,5104,5134,4838,3858,5008,4828,5234,4324,5282,5348,5150,4724,4682,
4720,5218,4744,4742,4760,5194,4792,4712,4754,4704};
int stack[72],top,aim;
void out()
{
int i;
for (i=0;i<top;i++)
{
printf("%d ",stack[i]);
}
printf("\n");
}
void dfs(int now,int forstart)
{
int i;
if (now==aim)
{
out();
return ;
}
for (i=forstart;i<72;i++)
{
if (now+data[i]<=aim)
{
stack[top++]=data[i];
dfs(now+data[i],i+1);
top--;
}
}
return ;
}
int main()
{
while (scanf("%d",&aim))
{
top=0;
dfs(0,0);
}
return 0;
}