import scala.io.Source.stdin
object Main {
   
  def main(args: Array[String]): Unit = {
    var Lines =for{
      input <- stdin.getLines.toList
    }yield input.map(chara => chara.toLower)
    println(if((Lines(0)+Lines(0)).contains(Lines(1))) "Yes" else "No")
  }
}