main = do
  s <- getLine
  t <- getLine
  putStrLn $ if f s t 0 then "Yes" else "No"
f x y n
  | tail x ++ [head x] == y = True
  | n == length x = False
  | otherwise = f (tail x ++ [head x]) y (n+1)