import scala.io.StdIn.readLine

object Main extends App {
  val s = readLine()
  val t = readLine()
  
  def rotate(str: String): String = {
    str.last + str.init
  }
  
  def verify(in: String): String = {
    if (in == t)
      "Yes"
    else
      if (in == s)
        "No"
      else
        verify(rotate(in))
  }
  
  val result = if (s == t)
    "Yes"
  else
    verify(rotate(s))
  
  println(result)
}