Function Check(k : Longint) : Boolean; Var j : Byte; Begin Check:=True; j:=k; While j>0 do Begin If (j mod 10 = 0) or (k mod (j mod 10)<>0) then Check:=False; j:=j div 10; end; end;
Var n,i : Longint; Begin Readln(n); For i:=1 to n do If Check(i) then Writeln(i); end.
Var j : Byte;
Begin
Check:=True;
j:=k;
While j>0 do
Begin
If (j mod 10 = 0) or (k mod (j mod 10)<>0) then Check:=False;
j:=j div 10;
end;
end;
Var
n,i : Longint;
Begin
Readln(n);
For i:=1 to n do
If Check(i) then Writeln(i);
end.