main :: IO ()
main = do
    s <- getLine :: IO String
    t <- getLine :: IO String
    putStrLn $ if judge s t then "Yes" else "No"

judge :: String -> String -> Bool
judge s t = t `elem` [ rotate i s | i <- [1 .. length s]]

rotate :: Int -> String -> String
rotate i s = let (u, v) = splitAt i s in v ++ u
