solver::String -> String -> Bool
solver str1 str2 = let rot = (str1++str1):[(tail ls)|ls<-rot] in
                   let n = length str1 in
                   let rot2 = map (take n) (take n rot) in
                   or (map (str2==) rot2)

main::IO()
main=do
  s<-getLine
  t<-getLine
  putStr (if solver s t then "Yes\n" else "No\n")
