rot (a:as) = as ++ [a]

f _ _ 0 = False
f s t n = if s == t then True else f (rot s) t (n - 1)

main = do
    s <- getLine
    t <- getLine
    let n = length s
    putStrLn $ if f s t n then "Yes" else "No"