main = do
  [s, t] <- sequence [getLine, getLine]
  putStrLn $ ckStr s t (length s)


ckStr :: String -> String -> Int -> String
ckStr str1 str2 count
  | count == 0   = "No"
  | str1 == str2 = "Yes"
  | otherwise    = ckStr str1' str2 (count - 1)
      where str1' = (last str1):(init str1)
