module Main where
 
import Control.Applicative
import Numeric
import Data.Char
import Data.List
import Data.Ord
import Control.Monad
 
solve :: [String] -> String
solve [s,p] =
    if (isInfixOf p $ s ++ s) then
        "Yes"
    else
        "No"
         
main = putStrLn =<< solve . lines <$> getContents
     
--
getIntegers :: IO [Integer]
getIntegers = map read . words <$> getLine
 
getInts :: IO[Int]
getInts = map read . words <$> getLine
 
putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show
 
getDoubles :: IO [Double]
getDoubles = map read . words <$> getLine
 
putDoubles :: [Double] -> IO ()
putDoubles = putStrLn . unwords . map showDouble
 
showDouble :: Double -> String
showDouble d = showFFloat Nothing d ""
