program exp
implicit none
integer i,j,base,index
integer in,temp,exponential(base,index)
read *, in ! 1<=in<=1000
base = 1
index =1
do i=1,sqrt(in)  ! Base of exponential
  do j=1, 9 ! Index of exponential, 2^10>1000 therefore j<=9
    if(i**j>1000) then
      if(sqrt(in)**(j-1)>exponential(base,index)) then
        base=i
        index = j-1
      end if
    end if
  end do
end do
end program exp