object Main extends App {
	var s = scala.io.StdIn.readLine.toList.reverse
	val t = scala.io.StdIn.readLine.toList.reverse

	var flag = false

	for(i<-0 until s.size){
		if(s == t) flag = true
		var tp = s.head
		s = s.tail :+ tp
	}

	if(flag) println("Yes")
	else println("No")
}
