n=0 while n<1e4:n+=1;s="".join(sorted(str(n)));r=s[::s>"1"!=n>9!=s[0]==s[1]or-1];p=r[1:]+r[0];p==p[::-1]!=print(p)