const
m=1000;
var
a: array[1..m]of integer;
k,n: integer;
procedure zz(j,n: integer);
var
i: integer;
begin
if (n=0)then begin
for i:=1 to k do Write(a[i]:4);
WriteLn
end
else for i:=j to n do begin
Inc(k);
a[k]:=i;
zz(i+1,n-i);
Dec(k);
end
end;
begin
Write('n = ');
ReadLn(n);
k:=0;
zz(1,n);
ReadLn
end.