fun main(args: Array<String>) {
    var S = readLine()!!; val T = readLine()!!
    for (i in S.indices) {
        if (S == T) {
            println("Yes")
            return
        }
        S = S.last() + S.dropLast(1)
    }
    println("No")
}