      program soinsubunkai

      parameter (max=10000)
      integer ns(max),i,j,m,n

      read (*,*) m
      write(*,*) m

      n=2
      ns(1)=2

 300  continue
      if(mod(m,ns(1)).eq.0) then
        m=m/ns(1)
        write(*,*) ns(1),m
        if(m.le.1) then 
          goto 500
        else
          goto 300
        endif
      endif

      do i=2,max
 100    n=n+1
        do j=1,i-1
          if(mod(n,ns(j)).eq.0) goto 100
        enddo
        ns(i)=n

 400    continue
        if(mod(m,ns(i)).eq.0) then
          m=m/ns(i)
          write(*,*) ns(i),m
          if(m.le.1) then
            goto 500
          else
            goto 400
          endif
        endif
      enddo

      write(*,*) "max:", max, ns(max)
c      do i=1,max
c        write (*,*) i, ns(i)
c      enddo

500   stop
      end
