import java.util.*

fun main(args: Array<String>) {
    val S = readLine()!!
    val T = readLine()!!

    if (S == T) {
        println("Yes")
        return
    }

    val s = ArrayDeque<Char>(S.toCharArray().toList())
    repeat(S.length - 1) {
        s.addFirst(s.removeLast())
        if (s.joinToString("") == T) {
            println("Yes")
            return
        }
    }
    println("No")
}
