//PascalABC.Net 3.2 сборка 1318
Var
n,i,count:integer;
s:string;
procedure NumPrin(counter,last:integer;num:string);
Var
i:integer;
begin
if not ((last=10) and (n-counter<>1)) then
if counter<>n then
for i:=last+1 to 9 do
NumPrin(counter+1,i,num+inttostr(i))
else
writeln(num);
end;
begin
readln(n);
dec(n);
count:=0;
for i:=1 to 9 do
begin
s:=inttostr(i);
NumPrin(count,i,s);
end;
end.