object Main extends App {
    def func():Boolean = {
        var s = scala.io.StdIn.readLine()
        val t = scala.io.StdIn.readLine()
        for (_ <- 1 to s.length){
            s = s.tail + s.head
            if (s==t) return true
        }
        return false
    }
    if (func()) println("Yes") else println("No")
}