var i,k:word=9;begin repeat i:=i+1;k:=i;while k div$amod$a>k mod 10do k:=k div$a;if k<10then writeln(i)until i>1e4end.