object Main extends App {
  def rotate(chars:Array[Char]) = {
    chars.last +: chars.init
  }
  def isEqual(chars1:Array[Char],chars2:Array[Char]) = {
    (0 until chars1.length).map(i=>{
      chars1(i)==chars2(i)
    }).forall(f=>f)
  }
  val scanner = new java.util.Scanner(System.in)
  var s = scanner.next().toCharArray
  val t = scanner.next().toCharArray
  var flag = false
  (0 until s.length).foreach(_ => {
    if (isEqual(s,t)){
      flag = true
    }
    s = rotate(s)
  })
  if (flag){
    println("Yes")
  } else {
    println("No")
  }
}