import Data.Bool
import Data.List
import Control.Arrow
import Data.Tuple

main = do 
  test <- getLine
  target <- getLine
  putStrLn (bool "No" "Yes" (isRotated test target))

isRotated x y = do
  let tops = elemIndices (head x) y
  let candidates = (map (flip splitAt y) >>> map (swap >>> uncurry (++))) tops
  any (== x) candidates