program string_rotation
  implicit none
  character(200) :: s, t
  integer :: n, i
  read(*,*) s
  read(*,*) t
  n = len_trim(s)
  s(n+1:2*n) = s(1:n)
  do i = 1, n
    if (s(i:i+n-1) == t(1:n)) then
      write(*,'(a)') "Yes"
      stop
    end if
  end do
  write(*,'(a)') "No"
end program string_rotation