module Main where

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

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

--
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 ""

