object Main extends App{
  var S = readLine
  var T = readLine
  var res = true
  if(S.length!=T.length) res= false
  if(res) res = find(S,T)
  if(res) println("Yes")
  else println("No")
}


object function{
  def find(s:String,t:String):Boolean={
    if(s.equals(t)) return true
    var len = s.length
    for(i <- 0 until len){
      s = s.charAt(len-1) + s.substring(0,len-1)
      if(s.euqals(t)) return true
    }
    false
  }
}
