program answer
  implicit none

  character(len=100):: S, T, U
  integer :: i, j, a

  read(*,*) S
  read(*,*) T

  a=len_trim(S)

  if(a==1) then
     if(S==T) then
        write(*,*) 'Yes'
        stop
     else
        write(*,*) 'No'
        stop
     end if
  end if

  
  do j = 1, a-1
     U=S
        S(j+1:j+1)=U(j:j)
        S(1:1)=U(a:a)
        if(S==T) then
           write(*,*) 'Yes'
           stop
        end if
     end do
    
     write(*,*) 'No'     

  stop
 end program answer
