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
1982
991 991
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!