program answer
  implicit none

  integer :: i, a
  character(len=100) :: S, T
  character (len=1) :: saigo

  read(*,*) S
  read(*,*) T
  a=len_trim(S)
 
  do i = 1, a
     saigo=S(a:a)
     S(2:a)=S(1:a-1)
     S(1:1)=saigo
     if(S==T) then
        write(*,*) 'Yes'
        stop
     end if
  end do

  write(*,*) 'No'

  stop
 end program answer
     