n=9 while n<1e4: n+=1;x=p=n;b=0 while x:b|=-6<p-x%10<6;p=x%10;x/=10 if~-b:print n

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top