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'
     end if
  end if
  
  i=1
  do while(i<a)
     if(S==T) then
        i=0
        exit
     end if
     U=S
     do j = 1, a-1
        S(j+1:j+1)=U(j:j)
     end do
     S(1:1)=U(a:a)
     i=i+1
  end do

  if(i==0) then
     write(*,*) 'Yes'
  else
     write(*,*) 'No'
  end if
     

  stop
 end program answer
