module Main where

import Control.Applicative
import Numeric
import Data.Char
import Data.List
import Data.Ord
-- import Control.Monad

main :: IO ()
main = do
  { l1 <- getLine
  ; l2 <- getLine
  ; let l1' = l1 ++ l1
  ; if isInfixOf l2 l1' then putStrLn "Yes" else putStrLn "No"
  }

