S=sorted h=k=100 while k<1e6: k+=1;P=`k%h`;P+=P[~len(`k`)|6::-1] if S(P)==S(`k/h`):print P;k+=-k%h