n=input();k=m=1;p={0}while{n-k,k}-p:m*=k*k;k+=1;p|={m%k*k}print n-k,k
500
229 271
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!